.
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -12,6 +12,18 @@
|
||||
<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>
|
||||
|
||||
{% 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 %}
|
||||
<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
|
||||
@@ -85,6 +97,7 @@
|
||||
</div>
|
||||
<div class="marking">
|
||||
<form method="POST" class="post-form">{% csrf_token %}
|
||||
<input type="hidden" name="form_id" value="mark_form">
|
||||
{{ form.as_p }}
|
||||
<button type="submit" name="save" class="save btn btn-default" title="Save answer">Save</button>
|
||||
{% if next_unmarked_id %}
|
||||
|
||||
@@ -22,10 +22,8 @@
|
||||
<a href="{% url 'longs:mark_answer' exam.id question_details.current|add:'-1' answer.cid %}"
|
||||
title="Click to mark"> {{answer.cid}}</a>:
|
||||
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 %}
|
||||
|
||||
</li>
|
||||
|
||||
+8
-3
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user