diff --git a/longs/models.py b/longs/models.py index 9c775a71..5269acaa 100644 --- a/longs/models.py +++ b/longs/models.py @@ -797,6 +797,15 @@ class CidUserAnswer(models.Model): return "" return float(self.score) + def discrepant_answers(self): + marks = set(self.mark.values_list("score", flat=True)) + if len(marks) > 1: + return True + return False + + + + @reversion.register class AnswerMarks(models.Model): diff --git a/longs/templates/longs/mark_answer.html b/longs/templates/longs/mark_answer.html index f03ceebd..bafc980f 100644 --- a/longs/templates/longs/mark_answer.html +++ b/longs/templates/longs/mark_answer.html @@ -12,6 +12,18 @@

Marking question {{question_details.current}} of {{question_details.total}}

+{% if discrepancy_form %} +

This answer has discrepant scores

+Either edit your score before or set the overall score here.
+ +
{% csrf_token %} + + {{ discrepancy_form.as_p }} + +
+ +{% endif %} + {% if not next_unmarked_id and not unmarked %}
{% csrf_token %} + {{ form.as_p }} {% if next_unmarked_id %} diff --git a/longs/templates/longs/mark_question_double_overview.html b/longs/templates/longs/mark_question_double_overview.html index cc2501dc..60811a88 100644 --- a/longs/templates/longs/mark_question_double_overview.html +++ b/longs/templates/longs/mark_question_double_overview.html @@ -22,10 +22,8 @@ {{answer.cid}}: Score {{answer.get_answer_score}} [Markers: {{answer.get_markers}}] [Scores: {{answer.get_mark_scores}}] - {% if answer.is_marked %} - Score {{answer.get_answer_score}} - {% else %} - {{answer.get_mark_status}} + {% if answer.discrepant_answers %} + This answer has discrepant scores. {% endif %} diff --git a/longs/views.py b/longs/views.py index 5cb8f945..07b283b1 100755 --- a/longs/views.py +++ b/longs/views.py @@ -632,8 +632,6 @@ def loadJsonAnswer(answer): return True, None - -@login_required @user_is_long_marker @reversion.create_revision() def mark_answer(request, exam_id, question_number, cid): @@ -682,7 +680,7 @@ def mark_answer(request, exam_id, question_number, cid): # We use different forms if the exam should be single or double marked - if not exam.double_mark: + if not exam.double_mark or (request.method == "POST" and request.POST['form_id'] == 'discrepancy_form'): if request.method == "POST": form = MarkLongQuestionSingleForm(request.POST) @@ -751,6 +749,12 @@ def mark_answer(request, exam_id, question_number, cid): except AnswerMarks.DoesNotExist: form = MarkLongQuestionDoubleForm() + discrepancy_form = False + if answer.mark.count() == 2: + # if they do automatically update teh scoer + marks = set(answer.mark.values_list("score", flat=True)) + if len(marks) > 1: + discrepancy_form = MarkLongQuestionSingleForm(initial={'score': answer.score }) return render( request, @@ -758,6 +762,7 @@ def mark_answer(request, exam_id, question_number, cid): { "exam": exam, "form": form, + "discrepancy_form": discrepancy_form, "answer": answer, "question": question, "question_details": question_details,