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
+9
View File
@@ -797,6 +797,15 @@ class CidUserAnswer(models.Model):
return "" return ""
return float(self.score) 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 @reversion.register
class AnswerMarks(models.Model): class AnswerMarks(models.Model):
+13
View File
@@ -12,6 +12,18 @@
<h2>Marking question <a href="{% url 'longs:mark_question_overview' exam.id question_details.current|add:'-1' %}" <h2>Marking question <a href="{% url 'longs:mark_question_overview' exam.id question_details.current|add:'-1' %}"
title="View question answers">{{question_details.current}}</a> of {{question_details.total}}</h2> title="View question answers">{{question_details.current}}</a> of {{question_details.total}}</h2>
{% if discrepancy_form %}
<h3>This answer has discrepant scores</h3>
Either edit your score before or set the overall score here.<br/>
<form method="POST" class="post-form">{% csrf_token %}
<input type="hidden" name="form_id" value="discrepancy_form">
{{ discrepancy_form.as_p }}
<button type="submit" name="save" class="save btn btn-default" title="Save score">Save Score</button>
</form>
{% endif %}
{% if not next_unmarked_id and not unmarked %} {% if not next_unmarked_id and not unmarked %}
<div class="alert alert-info sticky-alert" role="alert">Success! Marking question complete. <br />Return to <a <div class="alert alert-info sticky-alert" role="alert">Success! Marking question complete. <br />Return to <a
href="{% url 'longs:mark_question_overview' exam.id question_details.current|add:'-1' %}">question href="{% url 'longs:mark_question_overview' exam.id question_details.current|add:'-1' %}">question
@@ -85,6 +97,7 @@
</div> </div>
<div class="marking"> <div class="marking">
<form method="POST" class="post-form">{% csrf_token %} <form method="POST" class="post-form">{% csrf_token %}
<input type="hidden" name="form_id" value="mark_form">
{{ form.as_p }} {{ form.as_p }}
<button type="submit" name="save" class="save btn btn-default" title="Save answer">Save</button> <button type="submit" name="save" class="save btn btn-default" title="Save answer">Save</button>
{% if next_unmarked_id %} {% if next_unmarked_id %}
@@ -22,10 +22,8 @@
<a href="{% url 'longs:mark_answer' exam.id question_details.current|add:'-1' answer.cid %}" <a href="{% url 'longs:mark_answer' exam.id question_details.current|add:'-1' answer.cid %}"
title="Click to mark"> {{answer.cid}}</a>: title="Click to mark"> {{answer.cid}}</a>:
Score {{answer.get_answer_score}} [Markers: {{answer.get_markers}}] [Scores: {{answer.get_mark_scores}}] Score {{answer.get_answer_score}} [Markers: {{answer.get_markers}}] [Scores: {{answer.get_mark_scores}}]
{% if answer.is_marked %} {% if answer.discrepant_answers %}
Score {{answer.get_answer_score}} This answer has discrepant scores.
{% else %}
{{answer.get_mark_status}}
{% endif %} {% endif %}
</li> </li>
+8 -3
View File
@@ -632,8 +632,6 @@ def loadJsonAnswer(answer):
return True, None return True, None
@login_required
@user_is_long_marker @user_is_long_marker
@reversion.create_revision() @reversion.create_revision()
def mark_answer(request, exam_id, question_number, cid): 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 # 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": if request.method == "POST":
form = MarkLongQuestionSingleForm(request.POST) form = MarkLongQuestionSingleForm(request.POST)
@@ -751,6 +749,12 @@ def mark_answer(request, exam_id, question_number, cid):
except AnswerMarks.DoesNotExist: except AnswerMarks.DoesNotExist:
form = MarkLongQuestionDoubleForm() 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( return render(
request, request,
@@ -758,6 +762,7 @@ def mark_answer(request, exam_id, question_number, cid):
{ {
"exam": exam, "exam": exam,
"form": form, "form": form,
"discrepancy_form": discrepancy_form,
"answer": answer, "answer": answer,
"question": question, "question": question,
"question_details": question_details, "question_details": question_details,