Merge ssh://penracourses.org.uk:/home/django/rad

This commit is contained in:
Ross
2021-09-09 11:12:12 +01:00
28 changed files with 283 additions and 127 deletions
+14 -8
View File
@@ -157,8 +157,8 @@ class AnatomyQuestion(models.Model):
exams = ", ".join(e)
return exams
def get_unmarked_answer_string(self):
unmarked_answers = self.get_unmarked_answers()
def get_unmarked_answer_string(self, exam_pk=None):
unmarked_answers = self.get_unmarked_answers(exam_pk)
if not unmarked_answers:
return "No answers to mark"
@@ -168,16 +168,22 @@ class AnatomyQuestion(models.Model):
)
)
def get_unmarked_answers(self):
user_answers = set(
[i.answer_compare for i in self.cid_user_answers.all()]
)
def get_unmarked_answers(self, exam_pk=None):
if exam_pk is None:
user_answers = set(
[i.answer_compare for i in self.cid_user_answers.all()]
)
else:
user_answers = set(
[i.answer_compare for i in self.cid_user_answers.filter(exam__id=exam_pk)]
)
unmarked_answers = user_answers - self.get_marked_answers()
return unmarked_answers
def get_unmarked_answer_count(self):
return len(self.get_unmarked_answers())
def get_unmarked_answer_count(self, exam_pk=None):
return len(self.get_unmarked_answers(exam_pk))
def get_marked_answers(self):
return set(
+16 -6
View File
@@ -40,7 +40,7 @@ a:link {
}
.answer-list.rapid .correct::after {
content: " [Score = 1]";
content: " [Score = 2]";
}
.answer-list .half-correct {
@@ -53,7 +53,7 @@ a:link {
}
.answer-list.rapid .half-correct::after {
content: " [Score = 0.5]";
content: " [Score = 1]";
}
.answer-list .incorrect {
@@ -377,11 +377,11 @@ img.uploading {
color: lightblue;
}
.rapid-ans.user-answer-score-1 {
.rapid-ans.user-answer-score-2 {
color: lightblue;
}
.rapid-ans.user-answer-score-0\.5 {
.rapid-ans.user-answer-score-1 {
/* color: green; */
color: yellow;
}
@@ -402,11 +402,11 @@ td.user-answer-score-2::after {
content: "✓✓";
}
td.user-answer-score-0\.5.rapid-ans::after {
td.user-answer-score-1.rapid-ans::after {
content: "✓";
}
td.user-answer-score-1.rapid-ans::after {
td.user-answer-score-2.rapid-ans::after {
content: "✓✓";
}
@@ -700,3 +700,13 @@ input {
background-color: green;
color: white;
}
.id {
opacity: 50%;
font-size: small;
}
.sticky-alert {
position: sticky;
top: 5px;
}
+2 -3
View File
@@ -59,10 +59,9 @@ $(document).ready(function () {
$("#question-mark-list li").show();
});
$(".show-unmarked-button").click(() => {
console.log("TESTIG");
$("#question-mark-list li").each((n, el) => {
console.log(el);
if (el.dataset.markcount < 1) { $(el).hide(); }
// Can't seem to get django to output this as a int....
if (parseInt(el.dataset.markcount) < 1) { $(el).hide(); }
})
});
@@ -34,6 +34,7 @@
{{ question.question_type }}: {{ question.get_primary_answer }}
<br />
Modality: {{ question.modality }}, <a href="{% url 'anatomy:question_detail' pk=question.pk %}">View</a>, <a href="{% url 'anatomy:mark' pk=exam.pk sk=forloop.counter0 %}">Mark</a>
<span class="id">[id: {{question.pk}}]</span>
</li>
{% endfor %}
</ol>
+3 -3
View File
@@ -20,13 +20,13 @@
Marked:
<ul id="marked-answer-list" class="answer-list">
{% for answer in correct_answers %}
<li><pre><span class="answer correct">{{ answer }}</span></pre></li>
<li><pre><span class="answer correct" title="{{answer}}">{{ answer }}</span></pre></li>
{% endfor %}
{% for answer in half_mark_answers %}
<li><pre><span class="answer half-correct">{{ answer }}</span></pre></li>
<li><pre><span class="answer half-correct" title="{{answer}}">{{ answer }}</span></pre></li>
{% endfor %}
{% for answer in incorrect_answers %}
<li><pre><span class="answer incorrect">{{ answer }}</span></pre></li>
<li><pre><span class="answer incorrect" title="{{answer}}">{{ answer }}</span></pre></li>
{% endfor %}
</ul>
<div class="answer-list key">Key: <span class="correct">2 Marks</span>, <span class="half-correct">1
+3 -3
View File
@@ -11,9 +11,9 @@
<div id="stark-marking-button"><a href="{% url 'anatomy:mark' pk=exam.pk sk=0 %}"><button>Click here to start marking</button></a></div>
<ul id="question-mark-list">
{% for question in questions.all %}
<li data-markcount={{question.get_unmarked_answer_count}}><a href="{% url 'anatomy:mark' pk=exam.pk sk=forloop.counter0 %}">Question {{forloop.counter }}:
{{ question }}</a><br /> {{ question.get_unmarked_answer_string }}</li>
{% for question, unmarked_count in question_unmarked_map %}
<li data-markcount={{unmarked_count}} {% if unmarked_count %}class="unmarked" {% endif %}><a href="{% url 'anatomy:mark' pk=exam.pk sk=forloop.counter0 %}">Question {{forloop.counter }}:
{{ question }}</a><br />Unmarked answers: {{ unmarked_count }}</li>
{% endfor %}
</ul>
</div>
+9 -4
View File
@@ -321,9 +321,10 @@ class ExamViews(View, LoginRequiredMixin):
preserved = Case(*[When(pk=pk, then=pos) for pos, pk in enumerate(new_order)])
objects = self.Question.objects.filter(pk__in=new_order).order_by(preserved)
if len(objects) != exam.exam_questions.count():
data = {"status": "error, count does not match"}
return JsonResponse(data, status=400)
# We now allow deleting exam questions
#if len(objects) != exam.exam_questions.count():
# data = {"status": "error, count does not match"}
# return JsonResponse(data, status=400)
exam.exam_questions.set(objects)
exam.save()
@@ -366,9 +367,13 @@ class ExamViews(View, LoginRequiredMixin):
questions = exam.exam_questions.all()
question_unmarked_map = []
for q in questions:
question_unmarked_map.append((q, int(q.get_unmarked_answer_count())))
# TODO: fix showing unmarked answer count from other exams...
return render(
request, "{}/mark_overview.html".format(self.app_name), {"exam": exam, "questions": questions}
request, "{}/mark_overview.html".format(self.app_name), {"exam": exam, "question_unmarked_map": question_unmarked_map}
)
@method_decorator(login_required)
+12 -4
View File
@@ -175,12 +175,20 @@ class Long(models.Model):
def get_image_url_array(self):
return json.dumps(["https://www.penracourses.org.uk{}".format(i.url) for i in self.get_images()])
def get_unmarked_answer_count(self):
answers = self.cid_user_answers.all()
def get_unmarked_answer_count(self, exam_pk=None):
if exam_pk is None:
answers = self.cid_user_answers.all()
else:
answers = self.cid_user_answers.filter(exam__id=exam_pk)
return len([ans for ans in answers if not ans.is_marked()])
def get_unmarked_answers(self):
answers = self.cid_user_answers.all()
def get_unmarked_answers(self, exam_pk=None):
if exam_pk is None:
answers = self.cid_user_answers.all()
else:
answers = self.cid_user_answers.filter(exam__id=exam_pk)
return [ans for ans in answers if not ans.is_marked()]
def get_question_json(self, based=True):
+1
View File
@@ -128,6 +128,7 @@ class UserAnswerTable(tables.Table):
fields = (
"cid",
"question",
"score",
#"normal",
#"answer",
#"answer_compare",
@@ -1,5 +1,4 @@
{% extends 'rapids/base.html' %}
{% extends 'longs/base.html' %}
{% block content %}
CID: {{ciduseranswer.cid}}
@@ -8,11 +7,16 @@ CID: {{ciduseranswer.cid}}
{{ciduseranswer.question}}
<h3>Answers</h3>
{{ciduseranswer.model_observations}}<br/>
{{ciduseranswer.model_interpretation}}<br/>
{{ciduseranswer.model_principle_diagnosis}}<br/>
{{ciduseranswer.model_differential_diagnosis}}<br/>
{{ciduseranswer.model_management}}<br/>
<h4>Observation</h4>
<pre>{{ciduseranswer.answer_observations}}</pre><br />
<h4>Interpretation</h4>
<pre>{{ciduseranswer.answer_interpretation}}</pre><br />
<h4>Principle Diagnosis</h4>
<pre>{{ciduseranswer.answer_principle_diagnosis}}</pre><br />
<h4>Differential Diagnosis</h4>
<pre>{{ciduseranswer.answer_differential_diagnosis}}</pre><br />
<h4>Managment</h4>
<pre>{{ciduseranswer.answer_management}}</pre><br />
+1
View File
@@ -43,6 +43,7 @@
<a href="{% url 'longs:exam_question_detail' exam.id forloop.counter0 %}"
title="View the question">View</a> / <a href="{% url 'longs:long_update' question.id %}"
title="Edit the question">Edit</a>
<span class="id">[id: {{question.pk}}]</span>
</div>
</span>
<span class="flex-col-3">
+2 -2
View File
@@ -44,14 +44,14 @@
<tr>
<th>Candidate</th>
{% for cid in cids %}
<th>{{cid}}</th>
<th><a href="{% url 'longs:exam_scores_cid_user' exam.pk cid %}">{{cid}}</a></th>
{% endfor %}
</tr>
</thead>
{% for question in questions %}
<tr>
<td>Question {{forloop.counter}}</td>
<td><a href="{% url 'longs:mark' pk=exam.pk sk=forloop.counter0 %}">Question {{forloop.counter}}</a></td>
{% for ans, score in by_question|get_item:question %}
<td class="user-answer-score-{{score}}" title="answer score: {{score}}">{{score}}</td>
{% endfor %}
@@ -2,6 +2,9 @@
<div class="date">
{{ question.created_date|date:"d/m/Y" }}
</div>
<div class="id">
ID: {{ question.id }}
</div>
<p class="pre-whitespace"><b>Description:</b> {{ question.description }}</p>
<p class="pre-whitespace"><b>History:</b> {{ question.history }}</p>
+2 -1
View File
@@ -1,7 +1,8 @@
{% extends 'longs/exams.html' %}
{% block content %}
<a href="{% url 'longs:exam_question_detail' exam.id question_details.current %}" title="View the Question">View</a>
<a href="{% url 'longs:exam_question_detail' exam.id question_details.current|add:'-1' %}"
title="View the Question">View</a>
<a href="{% url 'longs:long_update' question.id %}" title="Edit the Question">Edit</a> <a
href="{% url 'admin:longs_long_change' question.id %}" title="Edit the Question using the admin interface">Admin
Edit</a>
+20 -3
View File
@@ -13,9 +13,19 @@
title="View question answers">{{question_details.current}}</a> of {{question_details.total}}</h2>
{% if not next_unmarked_id and not unmarked %}
<div class="alert alert-info" role="alert">Success! Marking question complete. <a
href="{% url 'longs:mark_overview' pk=exam.pk %}">Return to marking
overview</a></div>
<div class="alert alert-info sticky-alert" role="alert">Success! Marking question complete. <br />Return to <a
href="{% url 'longs:mark' exam.id question_details.current|add:'-1' %}">question
overview</a>, <a href="{% url 'longs:mark_overview' pk=exam.pk %}">marking
overview</a><br />
{% if previous_cid %}
<a href="{% url 'longs:mark_answer' pk=exam.pk sk=question_details.current|add:'-1' cid=previous_cid %}">Previous
candidate</a>
{% endif %}
{% if next_cid %}
<a href="{% url 'longs:mark_answer' pk=exam.pk sk=question_details.current|add:'-1' cid=next_cid %}">Next
candidate</a>
{% endif %}
</div>
{% endif %}
<span>Marking CID: {{answer.cid}} ({{unmarked|length}} answer(s) left to mark)</span>
@@ -89,4 +99,11 @@
{% endif %}
</form>
</div>
{% if previous_cid %}
<a href="{% url 'longs:mark_answer' pk=exam.pk sk=question_details.current|add:'-1' cid=previous_cid %}">Previous
candidate</a>
{% endif %}
{% if next_cid %}
<a href="{% url 'longs:mark_answer' pk=exam.pk sk=question_details.current|add:'-1' cid=next_cid %}">Next candidate</a>
{% endif %}
{% endblock %}
+7 -7
View File
@@ -6,16 +6,16 @@
You can start marking from a particular question by clicking on it below.
<div>
<button class="show-all-button">Show all</button><button class="show-unmarked-button">Show unmarked</button>
<button class="show-all-button">Show all</button><button class="show-unmarked-button">Show unmarked</button>
</div>
<div id="stark-marking-button"><a href="{% url 'longs:mark' pk=exam.pk sk=0 %}"><button>Click here to start marking</button></a></div>
<div id="stark-marking-button"><a href="{% url 'longs:mark' pk=exam.pk sk=0 %}"><button>Click here to start
marking</button></a></div>
<ul id="question-mark-list">
{% for question in questions.all %}
<li data-markcount={{question.get_unmarked_answer_count}}
{% if question.get_unmarked_answer_count %}class="unmarked" {% endif %}
><a href="{% url 'longs:mark' pk=exam.pk sk=forloop.counter0 %}">Question {{forloop.counter }}:
{{ question }}</a><br /> Answers to mark: {{question.get_unmarked_answer_count}}</li>
{% for question, unmarked_count in question_unmarked_map %}
<li data-markcount={{unmarked_count}} {% if unmarked_count %}class="unmarked" {% endif %}><a
href="{% url 'longs:mark' pk=exam.pk sk=forloop.counter0 %}">Question {{forloop.counter }}:
{{ question }}</a><br /> Answers to mark: {{unmarked_count}}</li>
{% endfor %}
</ul>
</div>
+1 -1
View File
@@ -61,7 +61,7 @@ urlpatterns = [
# path("all_questions/", views.all_questions, name="all_questions"),
path("question/<int:pk>/scrap", views.long_scrap, name="long_scrap"),
path("question/<int:pk>/delete", views.LongDelete.as_view(), name="long_delete"),
path("exam/<int:pk>/<int:sk>/<int:tk>/mark", views.mark_answer, name="mark_answer"),
path("exam/<int:pk>/<int:sk>/<int:cid>/mark", views.mark_answer, name="mark_answer"),
path("exam/<int:pk>/<int:sk>/mark", views.mark, name="mark"),
path("exam/<int:pk>/mark", views.LongExamViews.mark_overview, name="mark_overview"),
# path("exam/<int:pk>/<int:sk>/", views.exam_take, name="exam_take"),
+33 -6
View File
@@ -468,6 +468,10 @@ class LongUpdate(RevisionMixin, LoginRequiredMixin, AuthorOrCheckerRequiredMixin
return context
def form_valid(self, form):
# save exam orders (there must be a better way to do this)
exam_orders = {}
for exam in self.object.exams.all():
exam_orders[exam] = list(exam.exam_questions.all())
self.object = form.save(commit=False)
self.object.save()
@@ -486,6 +490,14 @@ class LongUpdate(RevisionMixin, LoginRequiredMixin, AuthorOrCheckerRequiredMixin
response = super().form_valid(form)
series_formset.instance = self.object
series_formset.save()
# restore exam orders
for exam in self.object.exams.all():
if exam in exam_orders and self.object in exam_orders[exam]:
print(exam_orders[exam])
exam.exam_questions.set(exam_orders[exam])
exam.save()
return response
else:
return super().form_invalid(form)
@@ -639,7 +651,7 @@ def loadJsonAnswer(answer):
@login_required
@user_is_long_marker
@reversion.create_revision()
def mark_answer(request, pk, sk, tk):
def mark_answer(request, pk, sk, cid):
exam = get_object_or_404(Exam, pk=pk)
questions = exam.exam_questions.all()
@@ -657,14 +669,27 @@ def mark_answer(request, pk, sk, tk):
raise Http404("Exam question does not exist")
try:
answer = question.cid_user_answers.get(cid=tk, exam__id=pk)
answer = question.cid_user_answers.get(cid=cid, exam__id=pk)
except ObjectDoesNotExist:
raise Http404("User answer does not exist")
cid_list = list(question.cid_user_answers.filter(exam__id=pk).values_list("cid", flat=True))
previous_cid = False
next_cid = False
if cid_list[0] == cid:
next_cid = cid_list[1]
elif cid_list[-1] == cid:
previous_cid = cid_list[-2]
else:
next_cid = cid_list[cid_list.index(cid)+1]
previous_cid = cid_list[cid_list.index(cid)-1]
try:
unmarked = question.get_unmarked_answers()
next_unmarked_id = unmarked[0].cid
if next_unmarked_id == tk:
if next_unmarked_id == cid:
next_unmarked_id = unmarked[1].cid
except IndexError:
next_unmarked_id = False
@@ -677,16 +702,16 @@ def mark_answer(request, pk, sk, tk):
# If skip button is pressed skip the question without marking
# Skip is problematic if we skip to the next unmarked answer
#if "skip" in request.POST:
# return redirect("longs:mark_answer", pk=pk, sk=sk, tk=next_unmarked_id)
# return redirect("longs:mark_answer", pk=pk, sk=sk, cid=next_unmarked_id)
# Extract score from form and save it to the object
answer.score = form.cleaned_data["score"]
answer.save()
if "next" in request.POST:
return redirect("longs:mark_answer", pk=pk, sk=sk, tk=next_unmarked_id)
return redirect("longs:mark_answer", pk=pk, sk=sk, cid=next_unmarked_id)
if "save" in request.POST:
return redirect("longs:mark_answer", pk=pk, sk=sk, tk=tk)
return redirect("longs:mark_answer", pk=pk, sk=sk, cid=cid)
#elif "previous" in request.POST:
# return redirect("longs:mark", pk=pk, sk=n - 1)
@@ -705,6 +730,8 @@ def mark_answer(request, pk, sk, tk):
"question_details": question_details,
"next_unmarked_id": next_unmarked_id,
"unmarked": unmarked,
"previous_cid": previous_cid,
"next_cid": next_cid,
},
)
+29 -11
View File
@@ -231,8 +231,8 @@ class Rapid(models.Model):
exams = ", ".join(e)
return exams
def get_unmarked_answer_string(self):
unmarked_answers = self.get_unmarked_answers()
def get_unmarked_answer_string(self, exam_pk=None):
unmarked_answers = self.get_unmarked_answers(exam_pk)
if not unmarked_answers:
return "No answers to mark"
@@ -242,20 +242,38 @@ class Rapid(models.Model):
)
)
def get_unmarked_answers(self):
def get_unmarked_answers(self, exam_pk=None):
# If normal no answers to mark
if self.normal:
return []
user_answers = set(
[i.answer_compare for i in self.cid_user_answers.all() if i.normal == False]
)
if exam_pk is None:
user_answers = set(
[i.answer_compare for i in self.cid_user_answers.all() if i.normal == False]
)
else:
user_answers = set(
[i.answer_compare for i in self.cid_user_answers.filter(exam__id=exam_pk) if i.normal == False]
)
unmarked_answers = user_answers - self.get_marked_answers()
return unmarked_answers
def get_unmarked_answer_count(self):
return len(self.get_unmarked_answers())
def get_unmarked_answer_count(self, exam_pk=None):
return len(self.get_unmarked_answers(exam_pk))
def get_user_answers(self, exam_pk=None):
if exam_pk is None:
user_answers = set(
[i.answer_compare for i in self.cid_user_answers.all()]
)
else:
user_answers = set(
[i.answer_compare for i in self.cid_user_answers.filter(exam__id=exam_pk)]
)
return user_answers
def get_compare_answers(self):
return set(
@@ -601,7 +619,7 @@ class CidUserAnswer(models.Model):
return 0
# If both are normal full marks
elif q.normal and self.normal:
return 1
return 2
# Then compare answer strings (as per anatomy questions)
ans = self.answer_compare
@@ -616,9 +634,9 @@ class CidUserAnswer(models.Model):
mark = "unmarked"
if marked_ans is not None:
if marked_ans.status == Answer.MarkOptions.CORRECT:
mark = 1
mark = 2
elif marked_ans.status == Answer.MarkOptions.HALF_MARK:
mark = 0.5
mark = 1
elif marked_ans.status == Answer.MarkOptions.INCORRECT:
mark = 0
+31 -22
View File
@@ -11,12 +11,12 @@
<h1>Exam: {{ exam.name }}</h1>
This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds.<br />
<div class="parent-help" title="">
Normal count: {{ exam.get_normal_abnormal_breakdown }}<span
class="help-text">[Number of normal questions within the exam]</span>
Normal count: {{ exam.get_normal_abnormal_breakdown }}<span class="help-text">[Number of normal questions within
the exam]</span>
</div>
<div class="parent-help" title="">
Exam mode: {{ exam.exam_mode }}<span
class="help-text">[When true the packet will be taken as an exam (it will not self mark and results will be saved here)]</span>
Exam mode: {{ exam.exam_mode }}<span class="help-text">[When true the packet will be taken as an exam (it will
not self mark and results will be saved here)]</span>
</div>
<div class="parent-help" title="Click to enable / disable the exam">
@@ -37,24 +37,25 @@
<li data-question_pk={{question.pk}}>
<span class="flex-col">
<a href="{% url 'rapids:exam_question_detail' pk=exam.pk sk=forloop.counter0 %}">
{% for image in question.get_images %}
<img src="{{ image|thumbnail_url:'exam-list' }}" alt="thumbail" />
{% endfor %}
</a>
<a href="{% url 'rapids:exam_question_detail' pk=exam.pk sk=forloop.counter0 %}">
{% for image in question.get_images %}
<img src="{{ image|thumbnail_url:'exam-list' }}" alt="thumbail" />
{% endfor %}
</a>
</span>
<span class="flex-col-4">
{% if not question.normal %}
<b>Abnormality:</b> {{ question.get_abnormalities }} <b>Region:</b> {{ question.get_regions }}
<br />
{{ question.get_primary_answer }}
{% else %}
<b>Normal</b>
{% endif %}
<br />
Examination: {{ question.get_examinations }}, <a
href="{% url 'rapids:question_detail' pk=question.pk %}">View</a>, <a
href="{% url 'rapids:mark' pk=exam.pk sk=forloop.counter0 %}">Mark</a>
{% if not question.normal %}
<b>Abnormality:</b> {{ question.get_abnormalities }} <b>Region:</b> {{ question.get_regions }}
<br />
{{ question.get_primary_answer }}
{% else %}
<b>Normal</b>
{% endif %}
<br />
Examination: {{ question.get_examinations }}, <a
href="{% url 'rapids:question_detail' pk=question.pk %}">View</a>, <a
href="{% url 'rapids:mark' pk=exam.pk sk=forloop.counter0 %}">Mark</a>
<span class="id">[id: {{question.pk}}]</span>
</span>
</li>
{% endfor %}
@@ -64,7 +65,7 @@
{{ author }},
{% endfor %}
</div>
<p><button id='button-edit-order'>Edit exam order</button></p>
<p><button id='button-edit-order' title='click and drag questions to change order'>Edit exam order</button></p>
<div>
JSON creation time: {{exam.json_creation_time}} ({{exam.json_creation_time|date:"c"}}),
JSON creation id: {{exam.exam_json_id}}
@@ -187,7 +188,15 @@
$(this).remove();
sortable('.sortable');
$("#full-question-list").append($("<button>Save exam order</button>").click(() => {
$("#full-question-list li").each((n, el) => {
$(el).append($(
"<span class='exam-question-delete flex-col'><button>DELETE</button></span>"
).click(() => {
el.remove();
}));
})
$("#full-question-list").append($("<button title='click and drag questions to change order'>Save exam order</button>").click(() => {
new_order = [];
$("#full-question-list li").each((n, el) => {
new_order.push(el.dataset.question_pk)
+8 -2
View File
@@ -44,14 +44,20 @@
<tr>
<th>Candidate</th>
{% for cid in cids %}
<th>{{cid}}</th>
<th><a href="{% url 'rapids:exam_scores_cid_user' exam.pk cid %}">{{cid}}</a></th>
{% endfor %}
</tr>
</thead>
{% for question in questions %}
<tr>
<td><a href="{% url 'rapids:mark' pk=exam.pk sk=forloop.counter0 %}">Question {{forloop.counter}}</a></td>
<td><a href="{% url 'rapids:mark' pk=exam.pk sk=forloop.counter0 %}">Question {{forloop.counter}}</a>
{% if question.normal %}
[N]
{% else %}
[A]
{% endif %}
</td>
{% for ans, score in by_question|get_item:question %}
<td class="rapid-ans user-answer-score-{{score}}" title="answer score: {{score}}">{{ans}}</td>
{% endfor %}
+31 -17
View File
@@ -2,15 +2,29 @@
{% block content %}
<h2>Marking question {{question_details.current}} of {{question_details.total}}</h2>
<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
<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 'admin:rapids_rapid_change' question.id %}" title="Edit the Question using the admin interface">Admin
Edit</a>
{% if question.normal %}
<h3>This question is normal</h3>
Answers will be automatically marked.
Answers will be automatically marked.<br />
{% if incorrect_answers %}
<p>The following answers have been submitted for this question</p>
<div class="marking-list">
<ul id="new-answer-list" class="answer-list rapid">
{% for answer in incorrect_answers %}
<li>
<pre><span class="answer incorrect" title="{{answer}}">{{ answer }}</span></pre>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% else %}
<h3>This question is abnormal</h3>
Answers marked as normal will be automatically marked.<br/>
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}}"
@@ -33,33 +47,33 @@ Region: {{ question.get_regions }}, Abnormalities: {{ question.get_abnormalities
<ul id="marked-answer-list" class="answer-list rapid">
{% for answer in correct_answers %}
<li>
<pre><span class="answer correct">{{ answer }}</span></pre>
<pre><span class="answer correct" title="{{answer}}">{{ answer }}</span></pre>
</li>
{% endfor %}
{% for answer in half_mark_answers %}
<li>
<pre><span class="answer half-correct">{{ answer }}</span></pre>
<pre><span class="answer half-correct" title="{{answer}}">{{ answer }}</span></pre>
</li>
{% endfor %}
{% for answer in incorrect_answers %}
<li>
<pre><span class="answer incorrect">{{ answer }}</span></pre>
<pre><span class="answer incorrect" title="{{answer}}">{{ answer }}</span></pre>
</li>
{% endfor %}
</ul>
<div class="answer-list key">Key: <span class="correct">1 Marks</span>, <span class="half-correct">0.5
<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 %}
{% 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>
+3 -3
View File
@@ -11,9 +11,9 @@
<div id="stark-marking-button"><a href="{% url 'rapids:mark' pk=exam.pk sk=0 %}"><button>Click here to start marking</button></a></div>
<ul id="question-mark-list">
{% for question in questions.all %}
<li data-markcount={{question.get_unmarked_answer_count}}><a href="{% url 'rapids:mark' pk=exam.pk sk=forloop.counter0 %}">Question {{forloop.counter }}:
{{ question }}</a><br /> {{ question.get_unmarked_answer_string }}</li>
{% for question, unmarked_count in question_unmarked_map %}
<li data-markcount={{unmarked_count}} {% if unmarked_count %}class="unmarked" {% endif %}><a href="{% url 'rapids:mark' pk=exam.pk sk=forloop.counter0 %}">Question {{forloop.counter }}:
{{ question }}</a><br />Unmarked answers: {{unmarked_count}}</li>
{% endfor %}
</ul>
</div>
@@ -1,7 +1,11 @@
<div class="rapid {% if question.scrapped %}rapid-scrapped{% endif %}">
<button id="edit-button">Inline Edit</button>
<div class="date">
{{ question.created_date|date:"d/m/Y" }}
</div>
<div class="id">
ID: {{ question.id }}
</div>
<p class="pre-whitespace"><b>Rapid:</b> {{ question }}</p>
<p class="pre-whitespace"><b>Normal:</b> {{ question.normal }} <button id="toggle-normal-button"
@@ -107,6 +111,11 @@
</details>
<script>
$(document).ready(function () {
$("#edit-button").click(() => {
$(".toggle-button").toggle();
});
$(".toggle-button").hide();
// send request to change the is_private state on customSwitches toggle
$("#save-annotations").click(function () {
+1 -1
View File
@@ -56,7 +56,7 @@ urlpatterns = [
),
path("exam/<int:pk>/scores", cache_page(60 * 1)(views.exam_scores_cid), name="exam_scores_cid"),
path(
"exam/<int:pk>/scores/<int:sk>/",
"exam/<int:pk>/scores/<int:cid>/",
views.exam_scores_cid_user,
name="exam_scores_cid_user",
),
+11 -3
View File
@@ -776,6 +776,14 @@ def mark(request, pk, sk):
half_mark_answers = question.answers.filter(status=Answer.MarkOptions.HALF_MARK)
incorrect_answers = question.answers.filter(status=Answer.MarkOptions.INCORRECT)
# this could be improved
if question.normal:
incorrect_answers = question.get_user_answers()
if "" in incorrect_answers:
incorrect_answers.remove("")
if "normal" in incorrect_answers:
incorrect_answers.remove("normal")
return render(
request,
"rapids/mark.html",
@@ -873,7 +881,7 @@ def exam_scores_cid(request, pk):
)
fig_html = fig.to_html()
max_score = len(questions)
max_score = len(questions) * 2
return render(
request,
@@ -899,11 +907,11 @@ def exam_scores_cid(request, pk):
)
def exam_scores_cid_user(request, pk, sk):
def exam_scores_cid_user(request, pk, cid):
exam = get_object_or_404(Exam, pk=pk)
# TODO:Need some kind of test for cid
cid = sk
#cid = sk
questions = exam.exam_questions.all()
+16 -6
View File
@@ -40,7 +40,7 @@ a:link {
}
.answer-list.rapid .correct::after {
content: " [Score = 1]";
content: " [Score = 2]";
}
.answer-list .half-correct {
@@ -53,7 +53,7 @@ a:link {
}
.answer-list.rapid .half-correct::after {
content: " [Score = 0.5]";
content: " [Score = 1]";
}
.answer-list .incorrect {
@@ -377,11 +377,11 @@ img.uploading {
color: lightblue;
}
.rapid-ans.user-answer-score-1 {
.rapid-ans.user-answer-score-2 {
color: lightblue;
}
.rapid-ans.user-answer-score-0\.5 {
.rapid-ans.user-answer-score-1 {
/* color: green; */
color: yellow;
}
@@ -402,11 +402,11 @@ td.user-answer-score-2::after {
content: "✓✓";
}
td.user-answer-score-0\.5.rapid-ans::after {
td.user-answer-score-1.rapid-ans::after {
content: "✓";
}
td.user-answer-score-1.rapid-ans::after {
td.user-answer-score-2.rapid-ans::after {
content: "✓✓";
}
@@ -700,3 +700,13 @@ input {
background-color: green;
color: white;
}
.id {
opacity: 50%;
font-size: small;
}
.sticky-alert {
position: sticky;
top: 5px;
}
+2 -3
View File
@@ -59,10 +59,9 @@ $(document).ready(function () {
$("#question-mark-list li").show();
});
$(".show-unmarked-button").click(() => {
console.log("TESTIG");
$("#question-mark-list li").each((n, el) => {
console.log(el);
if (el.dataset.markcount < 1) { $(el).hide(); }
// Can't seem to get django to output this as a int....
if (parseInt(el.dataset.markcount) < 1) { $(el).hide(); }
})
});