From 6bb28ddbc37f771ef18f64494e975310d9533258 Mon Sep 17 00:00:00 2001 From: gtitov Date: Sun, 6 Nov 2022 12:18:09 +0300 Subject: [PATCH] handle empty radio answers --- gui/main.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gui/main.js b/gui/main.js index 57bfe5b..6833058 100644 --- a/gui/main.js +++ b/gui/main.js @@ -67,6 +67,13 @@ document.addEventListener("DOMContentLoaded", function () { var button = document.createElement('button'); button.innerHTML = 'Сдать'; button.onclick = function () { + // TODO: move this logic to the backend check_answers function + // Populate quiz with empty answers (if no answer presented in select there'll be no property "answer" what could not be resolved in API) + for (const question of quiz.questions) { + question.student_answer = "" + } + + // Replace the empty answers with real answers const form = document.getElementById('form'); const formData = new FormData(form); for (const [key, value] of formData) {