This commit is contained in:
Ross
2022-05-25 16:50:18 +01:00
parent 41a09ea30d
commit 5701c8d613
30 changed files with 402 additions and 226 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ class CidUserExamTable(tables.Table):
def __init__(self, data=None, *args, **kwargs):
super().__init__(
data.prefetch_related(
#"physics_exams", "rapid_exams", "sba_exams", "anatomy_exams", "longs_exams",
"physics_exams", "rapid_exams", "sba_exams", "anatomy_exams", "longs_exams", "group"
),
*args,
**kwargs,
+4
View File
@@ -7,11 +7,15 @@
{% block content %}
<div id="view-filter-options">
<details class="filter">
<summary>
<h3>Filter CID Users </h3>
</summary>
<form action="" method="get">
{{ filter.form }}
<input class="btn btn-primary btn-sm mt-1 mb-1" type="submit" />
</form>
</details>
</div>
<div>
+2 -2
View File
@@ -1,7 +1,7 @@
{% extends app_name|add:'/base.html' %}
{% block content %}
<details>
<details class="filter">
<summary>
Filter exam list
</summary>
@@ -15,7 +15,7 @@
<div class="">
<h1><a href="{% url app_name|add:':exam_overview' pk=exam.pk %}">Exam: {{ exam.name }} </a></h1>
{% if exam.exam_mode %}
{% if app_name in "rapids longs anatomy physics" %}
{% if app_name in "rapids longs anatomy" %}
{% if request.user.is_staff %}<a href="{% url app_name|add:':mark_overview' pk=exam.pk %}">Mark answers</a>{% endif %}
{% endif %}
{% if request.user.is_staff %}<a href="{% url app_name|add:':exam_scores_cid' pk=exam.pk %}">Scores</a>{% endif %}
+5 -2
View File
@@ -1370,7 +1370,10 @@ class ExamViews(View, LoginRequiredMixin):
by_question = defaultdict(dict)
unmarked = set()
questions = exam.exam_questions.all().prefetch_related("answers")
if self.app_name in ("physics", "sbas"):
questions = exam.exam_questions.all()
else:
questions = exam.exam_questions.all().prefetch_related("answers")
# We could prefect the CidUserAnswers.answers here (if we didn't cache them)
cid_user_answers = self.CidUserAnswer.objects.select_related("question").filter(
@@ -1383,7 +1386,7 @@ class ExamViews(View, LoginRequiredMixin):
for cid_user_answer in cid_user_answers:
# Convoluted (probably...)
if cid_user_answer.user is None:
cid = cid_user_answer.cid
cid = f"c/{cid_user_answer.cid}"
# cid_passcodes[cid] = cid_user_answer.passcode
cids.add(cid)
else: