.
This commit is contained in:
@@ -663,6 +663,7 @@ class CidUserAnswer(models.Model):
|
|||||||
mark = "unmarked"
|
mark = "unmarked"
|
||||||
return mark
|
return mark
|
||||||
|
|
||||||
|
# Not used
|
||||||
@reversion.register
|
@reversion.register
|
||||||
class AnswerMarks(models.Model):
|
class AnswerMarks(models.Model):
|
||||||
score = models.CharField(
|
score = models.CharField(
|
||||||
|
|||||||
@@ -1,88 +1,90 @@
|
|||||||
{% extends 'rapids/exams.html' %}
|
{% extends 'rapids/exams.html' %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Marking question {{question_details.current}} of {{question_details.total}}</h2>
|
<h2>Marking question {{question_details.current}} of {{question_details.total}}{% if review %} [REVIEW]{% endif %}</h2>
|
||||||
<a href="{% url 'rapids:question_detail' question.id %}" title="View the Question">View</a> <a
|
<a href="{% url 'rapids:question_detail' question.id %}" title="View the Question">View</a> <a
|
||||||
href="{% url 'rapids:rapid_update' question.id %}" title="Edit the Question">Edit</a> <a
|
href="{% url 'rapids:rapid_update' question.id %}" title="Edit the Question">Edit</a> <a
|
||||||
href="{% url 'admin:rapids_rapid_change' question.id %}" title="Edit the Question using the admin interface">Admin
|
href="{% url 'admin:rapids_rapid_change' question.id %}" title="Edit the Question using the admin interface">Admin
|
||||||
Edit</a>
|
Edit</a>
|
||||||
{% if question.normal %}
|
{% if question.normal %}
|
||||||
<h3>This question is normal</h3>
|
<h3>This question is normal</h3>
|
||||||
Answers will be automatically marked.<br />
|
Answers will be automatically marked.<br />
|
||||||
|
|
||||||
{% if incorrect_answers %}
|
{% if incorrect_answers %}
|
||||||
<p>The following answers have been submitted for this question</p>
|
<p>The following answers have been submitted for this question</p>
|
||||||
<div class="marking-list">
|
<div class="marking-list">
|
||||||
<ul id="new-answer-list" class="answer-list rapid">
|
<ul id="new-answer-list" class="answer-list rapid">
|
||||||
{% for answer in incorrect_answers %}
|
{% for answer in incorrect_answers %}
|
||||||
<li>
|
<li>
|
||||||
<pre><span class="answer incorrect" title="{{answer}}">{{ answer }}</span></pre>
|
<pre><span class="answer incorrect" title="{{answer}}">{{ answer }}</span></pre>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
|
||||||
<h3>This question is abnormal</h3>
|
|
||||||
Answers marked as normal will be automatically marked.<br />
|
|
||||||
Region: {{ question.get_regions }}, Abnormalities: {{ question.get_abnormalities }}
|
|
||||||
{% endif %}
|
|
||||||
<div id="single-dicom-viewer" class="marking-dicom" data-images="{{question.get_image_url_array}}"
|
|
||||||
data-annotations='{{question.get_image_annotations}}'>
|
|
||||||
</div>
|
|
||||||
<div class="marking">
|
|
||||||
<form method="POST" class="post-form">{% csrf_token %}
|
|
||||||
{% if not question.normal %}
|
|
||||||
Click each answer to toggle through marks awarded (as per colour)<br/>
|
|
||||||
{% if unmarked_exam_answers_only %}
|
|
||||||
Showing exam answers only <a href="{% url 'rapids:mark_all' exam.id question_number %}">(view all)</a>
|
|
||||||
{% else %}
|
|
||||||
Showing all answers <a href="{% url 'rapids:mark' exam.id question_number %}">(view unmarked exam answers)</a>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
<div class="marking-list">
|
<h3>This question is abnormal</h3>
|
||||||
Unmarked:
|
Answers marked as normal will be automatically marked.<br />
|
||||||
<ul id="new-answer-list" class="answer-list rapid">
|
Region: {{ question.get_regions }}, Abnormalities: {{ question.get_abnormalities }}
|
||||||
{% for answer in user_answers %}
|
{% endif %}
|
||||||
<li>
|
<div id="single-dicom-viewer" class="marking-dicom" data-images="{{question.get_image_url_array}}"
|
||||||
<pre><span class="answer not-marked">{{ answer }}</span></pre>
|
data-annotations='{{question.get_image_annotations}}'>
|
||||||
</li>
|
</div>
|
||||||
{% endfor %}
|
<div class="marking">
|
||||||
</ul>
|
<form method="POST" class="post-form">{% csrf_token %}
|
||||||
Marked:
|
{% if not question.normal %}
|
||||||
<ul id="marked-answer-list" class="answer-list rapid">
|
Click each answer to toggle through marks awarded (as per colour)<br/>
|
||||||
{% for answer in correct_answers %}
|
{% if not review %}
|
||||||
<li>
|
{% if unmarked_exam_answers_only %}
|
||||||
<pre><span class="answer correct" title="{{answer}}">{{ answer }}</span></pre>
|
Showing exam answers only <a href="{% url 'rapids:mark_all' exam.id question_number %}">(view all)</a>
|
||||||
</li>
|
{% else %}
|
||||||
{% endfor %}
|
Showing all answers <a href="{% url 'rapids:mark' exam.id question_number %}">(view unmarked exam answers)</a>
|
||||||
{% for answer in half_mark_answers %}
|
{% endif %}
|
||||||
<li>
|
{% endif %}
|
||||||
<pre><span class="answer half-correct" title="{{answer}}">{{ answer }}</span></pre>
|
|
||||||
</li>
|
<div class="marking-list">
|
||||||
{% endfor %}
|
Unmarked:
|
||||||
{% for answer in incorrect_answers %}
|
<ul id="new-answer-list" class="answer-list rapid">
|
||||||
<li>
|
{% for answer in user_answers %}
|
||||||
<pre><span class="answer incorrect" title="{{answer}}">{{ answer }}</span></pre>
|
<li>
|
||||||
</li>
|
<pre><span class="answer not-marked">{{ answer }}</span></pre>
|
||||||
{% endfor %}
|
</li>
|
||||||
</ul>
|
{% endfor %}
|
||||||
<div class="answer-list key">Key: <span class="correct">2 Marks</span>, <span class="half-correct">1
|
</ul>
|
||||||
Mark</span>, <span class="incorrect">0 Marks</span></div>
|
Marked:
|
||||||
</div>
|
<ul id="marked-answer-list" class="answer-list rapid">
|
||||||
{% endif %}
|
{% for answer in correct_answers %}
|
||||||
{% if question_details.current > 1 %}
|
<li>
|
||||||
<button type="submit" name="previous" class="save btn btn-default">Previous</button>
|
<pre><span class="answer correct" title="{{answer}}">{{ answer }}</span></pre>
|
||||||
{% endif %}
|
</li>
|
||||||
<button type="submit" name="save" class="save btn btn-default">Save</button>
|
{% endfor %}
|
||||||
{% if question_details.current >= question_details.total %}
|
{% for answer in half_mark_answers %}
|
||||||
{% else %}
|
<li>
|
||||||
<button type="submit" name="next" class="save btn btn-default">Next</button>
|
<pre><span class="answer half-correct" title="{{answer}}">{{ answer }}</span></pre>
|
||||||
<button type="submit" name="skip" class="save btn btn-default">Skip</button>
|
</li>
|
||||||
{% endif %}
|
{% endfor %}
|
||||||
<span class=hide>
|
{% for answer in incorrect_answers %}
|
||||||
{{ form.as_p }}
|
<li>
|
||||||
</span>
|
<pre><span class="answer incorrect" title="{{answer}}">{{ answer }}</span></pre>
|
||||||
</form>
|
</li>
|
||||||
</div>
|
{% endfor %}
|
||||||
{% endblock %}
|
</ul>
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if question_details.current > 1 %}
|
||||||
|
<button type="submit" name="previous" class="save btn btn-default">Previous</button>
|
||||||
|
{% endif %}
|
||||||
|
<button type="submit" name="save" class="save btn btn-default">Save</button>
|
||||||
|
{% if question_details.current >= question_details.total %}
|
||||||
|
{% else %}
|
||||||
|
<button type="submit" name="next" class="save btn btn-default">Next</button>
|
||||||
|
<button type="submit" name="skip" class="save btn btn-default">Skip</button>
|
||||||
|
{% endif %}
|
||||||
|
<span class=hide>
|
||||||
|
{{ form.as_p }}
|
||||||
|
</span>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ urlpatterns = [
|
|||||||
),
|
),
|
||||||
path("exam/<int:exam_pk>/<int:sk>/mark", views.mark, name="mark"),
|
path("exam/<int:exam_pk>/<int:sk>/mark", views.mark, name="mark"),
|
||||||
path("exam/<int:exam_pk>/<int:sk>/mark/all", views.mark_all, name="mark_all"),
|
path("exam/<int:exam_pk>/<int:sk>/mark/all", views.mark_all, name="mark_all"),
|
||||||
|
path("exam/<int:exam_pk>/<int:sk>/mark/review", views.mark_all, name="mark_review"),
|
||||||
path(
|
path(
|
||||||
"exam/<int:pk>/mark", views.RapidExamViews.mark_overview, name="mark_overview"
|
"exam/<int:pk>/mark", views.RapidExamViews.mark_overview, name="mark_overview"
|
||||||
),
|
),
|
||||||
|
|||||||
+10
-11
@@ -572,16 +572,23 @@ def loadJsonAnswer(answer):
|
|||||||
return True, None
|
return True, None
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
def mark_all(request, exam_pk, sk):
|
def mark_all(request, exam_pk, sk):
|
||||||
return mark(request, exam_pk, sk, unmarked_exam_answers_only=False)
|
return mark(request, exam_pk, sk, unmarked_exam_answers_only=False)
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def mark_review(request, exam_pk, sk):
|
||||||
|
return mark(request, exam_pk, sk, unmarked_exam_answers_only=False, review=True)
|
||||||
|
|
||||||
# @user_passes_test(user_is_admin, login_url="/accounts/login")
|
# @user_passes_test(user_is_admin, login_url="/accounts/login")
|
||||||
@login_required
|
@login_required
|
||||||
def mark(request, exam_pk, sk, unmarked_exam_answers_only=True):
|
def mark(request, exam_pk, sk, unmarked_exam_answers_only=True, review=False):
|
||||||
exam = get_object_or_404(Exam, pk=exam_pk)
|
exam = get_object_or_404(Exam, pk=exam_pk)
|
||||||
|
|
||||||
mark_url = "rapids:mark"
|
mark_url = "rapids:mark"
|
||||||
if not unmarked_exam_answers_only:
|
if review:
|
||||||
|
mark_url = "rapids:mark_review"
|
||||||
|
elif not unmarked_exam_answers_only:
|
||||||
mark_url = "rapids:mark_all"
|
mark_url = "rapids:mark_all"
|
||||||
|
|
||||||
questions = exam.exam_questions.all()
|
questions = exam.exam_questions.all()
|
||||||
@@ -603,15 +610,6 @@ def mark(request, exam_pk, sk, unmarked_exam_answers_only=True):
|
|||||||
for ans in question.answers.all():
|
for ans in question.answers.all():
|
||||||
answers_dict[ans.answer_compare] = ans
|
answers_dict[ans.answer_compare] = ans
|
||||||
|
|
||||||
#marked_answers_set = set(answers_dict.keys())
|
|
||||||
|
|
||||||
# correct_answers = [i.answer.lower() for i in question.answers.all()]
|
|
||||||
# half_correct_answers = [
|
|
||||||
# i.answer.lower() for i in question.half_mark_answers.all()
|
|
||||||
# ]
|
|
||||||
# incorrect_answers = [
|
|
||||||
# i.answer.lower() for i in question.incorrect_answers.all()
|
|
||||||
# ]
|
|
||||||
|
|
||||||
if unmarked_exam_answers_only:
|
if unmarked_exam_answers_only:
|
||||||
unmarked_user_answers = question.get_unmarked_user_answers(exam_pk=exam_pk)
|
unmarked_user_answers = question.get_unmarked_user_answers(exam_pk=exam_pk)
|
||||||
@@ -692,6 +690,7 @@ def mark(request, exam_pk, sk, unmarked_exam_answers_only=True):
|
|||||||
{
|
{
|
||||||
"exam": exam,
|
"exam": exam,
|
||||||
"form": form,
|
"form": form,
|
||||||
|
"review": review,
|
||||||
"question": question,
|
"question": question,
|
||||||
"question_number": n,
|
"question_number": n,
|
||||||
"question_details": question_details,
|
"question_details": question_details,
|
||||||
|
|||||||
Reference in New Issue
Block a user