This commit is contained in:
Ross
2021-09-11 20:12:04 +01:00
parent 6900bf71ff
commit e39b543978
4 changed files with 32 additions and 7 deletions
+8 -3
View File
@@ -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,