.
This commit is contained in:
+2
-1
@@ -258,8 +258,9 @@ class Rapid(models.Model):
|
|||||||
[i for i in user_answer_queryset if i.normal == False and i.answer_compare not in marked_answers]
|
[i for i in user_answer_queryset if i.normal == False and i.answer_compare not in marked_answers]
|
||||||
)
|
)
|
||||||
|
|
||||||
#unmarked_answers = user_answers - self.get_marked_answers()
|
return [i.answer_compare for i in unmarked_answers]
|
||||||
|
|
||||||
|
# Marker code below is not used
|
||||||
if marker is None:
|
if marker is None:
|
||||||
return [i.answer_compare for i in unmarked_answers]
|
return [i.answer_compare for i in unmarked_answers]
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="marking-list">
|
<div class="marking-list">
|
||||||
|
{% if not review %}
|
||||||
Unmarked:
|
Unmarked:
|
||||||
<ul id="new-answer-list" class="answer-list rapid">
|
<ul id="new-answer-list" class="answer-list rapid">
|
||||||
{% for answer in user_answers %}
|
{% for answer in user_answers %}
|
||||||
@@ -51,6 +52,7 @@
|
|||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
Marked:
|
Marked:
|
||||||
<ul id="marked-answer-list" class="answer-list rapid">
|
<ul id="marked-answer-list" class="answer-list rapid">
|
||||||
{% for answer in correct_answers %}
|
{% for answer in correct_answers %}
|
||||||
@@ -69,6 +71,16 @@
|
|||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
{% else %}
|
||||||
|
To review:
|
||||||
|
<ul id="new-answer-list" class="answer-list rapid">
|
||||||
|
{% for answer, mark in review_user_answers %}
|
||||||
|
<li>
|
||||||
|
<pre><span class="answer not-marked" dataset-mark="{{mark}}">{{ answer }}</span></pre>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
<div class="answer-list key">Key: <span class="correct">2 Marks</span>, <span class="half-correct">1
|
<div class="answer-list key">Key: <span class="correct">2 Marks</span>, <span class="half-correct">1
|
||||||
Mark</span>, <span class="incorrect">0 Marks</span></div>
|
Mark</span>, <span class="incorrect">0 Marks</span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+33
-16
@@ -605,16 +605,6 @@ def mark(request, exam_pk, sk, unmarked_exam_answers_only=True, review=False):
|
|||||||
except IndexError:
|
except IndexError:
|
||||||
raise Http404("Exam question does not exist")
|
raise Http404("Exam question does not exist")
|
||||||
|
|
||||||
answers_dict = {}
|
|
||||||
|
|
||||||
for ans in question.answers.all():
|
|
||||||
answers_dict[ans.answer_compare] = ans
|
|
||||||
|
|
||||||
|
|
||||||
if unmarked_exam_answers_only:
|
|
||||||
unmarked_user_answers = question.get_unmarked_user_answers(exam_pk=exam_pk)
|
|
||||||
else:
|
|
||||||
unmarked_user_answers = question.get_unmarked_user_answers()
|
|
||||||
|
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
|
|
||||||
@@ -667,15 +657,16 @@ def mark(request, exam_pk, sk, unmarked_exam_answers_only=True, review=False):
|
|||||||
else:
|
else:
|
||||||
form = MarkRapidQuestionForm()
|
form = MarkRapidQuestionForm()
|
||||||
|
|
||||||
if unmarked_exam_answers_only:
|
#answers_dict = {}
|
||||||
|
|
||||||
|
#for ans in question.answers.all():
|
||||||
|
# answers_dict[ans.answer_compare] = ans
|
||||||
|
|
||||||
|
|
||||||
correct_answers = []
|
correct_answers = []
|
||||||
half_mark_answers = []
|
half_mark_answers = []
|
||||||
incorrect_answers = []
|
incorrect_answers = []
|
||||||
else:
|
review_user_answers = []
|
||||||
correct_answers = question.answers.filter(status=Answer.MarkOptions.CORRECT)
|
|
||||||
half_mark_answers = question.answers.filter(status=Answer.MarkOptions.HALF_MARK)
|
|
||||||
incorrect_answers = question.answers.filter(status=Answer.MarkOptions.INCORRECT)
|
|
||||||
|
|
||||||
# this could be improved
|
# this could be improved
|
||||||
if question.normal:
|
if question.normal:
|
||||||
incorrect_answers = question.get_user_answers()
|
incorrect_answers = question.get_user_answers()
|
||||||
@@ -683,6 +674,31 @@ def mark(request, exam_pk, sk, unmarked_exam_answers_only=True, review=False):
|
|||||||
incorrect_answers.remove("")
|
incorrect_answers.remove("")
|
||||||
if "normal" in incorrect_answers:
|
if "normal" in incorrect_answers:
|
||||||
incorrect_answers.remove("normal")
|
incorrect_answers.remove("normal")
|
||||||
|
else:
|
||||||
|
if review:
|
||||||
|
unmarked_user_answers = question.get_user_answers(exam_pk=exam_pk)
|
||||||
|
elif unmarked_exam_answers_only:
|
||||||
|
unmarked_user_answers = question.get_unmarked_user_answers(exam_pk=exam_pk)
|
||||||
|
else:
|
||||||
|
unmarked_user_answers = question.get_unmarked_user_answers()
|
||||||
|
|
||||||
|
|
||||||
|
if not unmarked_exam_answers_only or review:
|
||||||
|
correct_answers = question.answers.filter(status=Answer.MarkOptions.CORRECT)
|
||||||
|
half_mark_answers = question.answers.filter(status=Answer.MarkOptions.HALF_MARK)
|
||||||
|
incorrect_answers = question.answers.filter(status=Answer.MarkOptions.INCORRECT)
|
||||||
|
|
||||||
|
if review:
|
||||||
|
for ans in unmarked_user_answers:
|
||||||
|
mark = "unmarked"
|
||||||
|
if ans in correct_answers:
|
||||||
|
mark = "correct"
|
||||||
|
elif ans in half_mark_answers:
|
||||||
|
mark = "half-mark"
|
||||||
|
elif ans in incorrect_answers:
|
||||||
|
mark = "incorrect"
|
||||||
|
review_user_answers.append(ans, mark)
|
||||||
|
|
||||||
|
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
@@ -695,6 +711,7 @@ def mark(request, exam_pk, sk, unmarked_exam_answers_only=True, review=False):
|
|||||||
"question_number": n,
|
"question_number": n,
|
||||||
"question_details": question_details,
|
"question_details": question_details,
|
||||||
"user_answers": unmarked_user_answers,
|
"user_answers": unmarked_user_answers,
|
||||||
|
"review_user_answers": review_user_answers,
|
||||||
"correct_answers": correct_answers,
|
"correct_answers": correct_answers,
|
||||||
"half_mark_answers": half_mark_answers,
|
"half_mark_answers": half_mark_answers,
|
||||||
"incorrect_answers": incorrect_answers,
|
"incorrect_answers": incorrect_answers,
|
||||||
|
|||||||
Reference in New Issue
Block a user