Changed answer option object semantics to indices

Evaluating answer should no longer require string matching
Answers evaluated based on matching index value integers
This commit is contained in:
2021-12-08 12:49:32 +00:00
parent ff74e92297
commit 8680c73e86
2 changed files with 9 additions and 13 deletions

View File

@ -364,13 +364,13 @@ function render_question() {
for (let i = 0; i < options.length; i ++) {
var add_checked = ''
if (q_no in answers) {
if (answers[q_no] == options[i]) {
if (answers[q_no] == options[i][0]) {
add_checked = 'checked';
}
}
options_output += `<div class="form-check">
<input type="radio" class="form-check-input quiz-option" id="q${current_question}-${i}" name="${q_no}" value="${options[i]}" ${add_checked}>
<label for="q${current_question}-${i}" class="form-check-label">${options[i]}</label>
<input type="radio" class="form-check-input quiz-option" id="q${current_question}-${i}" name="${q_no}" value="${options[i][0]}" ${add_checked}>
<label for="q${current_question}-${i}" class="form-check-label">${options[i][1]}</label>
</div>`;
}
$question_options.html(options_output);