From a35d0ef7f10366039e3021a9aa9e42dbccb48e0e Mon Sep 17 00:00:00 2001 From: viveksantayana Date: Tue, 7 Dec 2021 12:27:06 +0000 Subject: [PATCH] Finessed remaining block question counter --- ref-test/quiz/static/js/quiz.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ref-test/quiz/static/js/quiz.js b/ref-test/quiz/static/js/quiz.js index 2df6068..7101631 100644 --- a/ref-test/quiz/static/js/quiz.js +++ b/ref-test/quiz/static/js/quiz.js @@ -347,7 +347,13 @@ function render_question() { if ('block_q_no' in question) { block_q_no = question['block_q_no']; } - header_text = header_text.replace('', (block_length - block_q_no).toString()); + let remaining_qs = (block_length - block_q_no).toString(); + if (block_length - block_q_no > 1) { + remaining_qs += ' questions'; + } else { + remaining_qs += ' question'; + } + header_text = header_text.replace('', remaining_qs); $question_header.html(header_text); $question_text.html(question.text); $question_title.html(`Question ${current_question + 1} of ${ questions.length }.`);