From 33258b6914e16f91a89005bb947b753d1b952810 Mon Sep 17 00:00:00 2001 From: Ross Date: Fri, 5 Aug 2022 11:05:31 +0100 Subject: [PATCH] . --- js/interact.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/js/interact.js b/js/interact.js index e91b514..e1f97c0 100644 --- a/js/interact.js +++ b/js/interact.js @@ -76,7 +76,8 @@ export function postAnswers(ans, config, exam_details) { $("#options-panel").show(); } else {} } else { - alert(`${data.question_count} answers sucessfully submitted.`); + //alert(`${data.question_count} answers sucessfully submitted.`); + alert(`Answers sucessfully submitted.`); } } else { submissionError(data, ans, exam_details); @@ -132,7 +133,7 @@ function submissionError(data, answer_json, exam_details) { if ($("#submit-error-overlay").length < 1) { $("body").append( - `

An error has occured when submit your answers. A copy of your answers are displayed below, you may wish to save a copy. Please try submitting again or refresh this page to continue.

${html.get(0).innerHTML}

${JSON.stringify( + `

An error has occured when submit your answers. A copy of your answers are displayed below, you may wish to save a copy. Please try submitting again or refresh this page to continue.

${html.get(0).innerHTML}

${JSON.stringify( answer_json )}

` ); @@ -140,6 +141,12 @@ function submissionError(data, answer_json, exam_details) { $("#nav-submit-button").prependTo("#submit-error-overlay"); $("#submit-error-overlay").height(docHeight); + + let file = new Blob([answer_json], {type: "application/json"}) + + link = document.getElementById("saved-failed-answers"); + link.href = URL.createObjectURL(file); + link.download = "answers.json"; } }