diff --git a/courses/templates/homework/homework.html b/courses/templates/homework/homework.html index 423da1c..a2ff9df 100644 --- a/courses/templates/homework/homework.html +++ b/courses/templates/homework/homework.html @@ -66,13 +66,11 @@

Questions

Question {{ forloop.counter }}. {{ question.text }} - {% if question.scores_for_correct_answer > 1 %} - ({{ question.scores_for_correct_answer }} points) - {% else %} - ({{ question.scores_for_correct_answer }} point) - {% endif %} + ({{ question.scores_for_correct_answer|pluralize }} point)

- + {% if is_authenticated and disabled and question.question_type == 'MC' and not answer.is_answered%} +

Question not answered

+ {% endif %} {% if question.question_type == 'MC' %} {% for option in answer.options %}
diff --git a/courses/views/homework.py b/courses/views/homework.py index 4f36ee6..e3fedd0 100644 --- a/courses/views/homework.py +++ b/courses/views/homework.py @@ -70,6 +70,7 @@ def process_question_options_multiple_choice_or_checkboxes( if homework.is_scored: correct_indices = question.get_correct_answer_indices() + is_answered = True if len(selected_options) > 0 else False for zero_based_index, option in enumerate(possible_answers): index = zero_based_index + 1 is_selected = index in selected_options @@ -93,7 +94,7 @@ def process_question_options_multiple_choice_or_checkboxes( options.append(processed_answer) - return {"options": options} + return {"options": options, "is_answered": is_answered} def extract_selected_options(answer): @@ -125,7 +126,7 @@ def extract_selected_options(answer): def determine_answer_class(is_selected: bool, is_correct: bool) -> str: if is_selected and is_correct: return "option-answer-correct" - if not is_selected and is_correct: + if not is_selected and is_correct: return "option-answer-correct" if is_selected and not is_correct: return "option-answer-incorrect"