{{ exam.name }}
- User answer scores are cached, if you update or change an answer you will need to
refresh the scores.
+ {% if cached_scores %}
+ User answer scores are cached, if you update or change an answer you will need to
refresh the scores.
+ {% endif %}
{% if unmarked %}
@@ -51,15 +53,17 @@
| Candidate |
{% for cid in cids %}
- {% comment %} {{cid}} | {% endcomment %}
+ {% comment %} {{cid}} | {% endcomment %}
{{cids_user_id_map|get_item:cid}} |
{% endfor %}
- {% for question in questions %}
+ {% block table_answers %}
+ {% endblock table_answers %}
+ {% comment %} {% for question in questions %}
- | Question {{forloop.counter}}
+ | Question {{forloop.counter}}
{% if question.normal %}
[N]
{% else %}
@@ -72,7 +76,7 @@
{% endwith %}
{% endfor %}
|
- {% endfor %}
+ {% endfor %} {% endcomment %}
| Score: |
{% for cid in cids %}
@@ -81,14 +85,7 @@
- Call breakdown
-
- {% for user, breakdown in user_answers_callstates.items %}
- -
- {{cids_user_id_map|get_item:user}} - {{breakdown}}
-
- {% endfor %}
-
+ {% block breakdown %}{% endblock breakdown %}
Email results
@@ -107,7 +104,7 @@
let additional_email = prompt("Please enter an additional email to send to (user and supervisor will automatically be used if available) if required");
- let url = "{% url 'rapids:exam_report_email' exam_id=exam.pk %}";
+ let url = "{% url exam.app_name|add:':exam_report_email' exam_id=exam.pk %}";
if ( additional_email != null ) {
url = url + "?additional_email="+encodeURI(additional_email)
@@ -120,7 +117,7 @@
})
$("#email-results-check-button").click((evt) => {
- window.location = "{% url 'rapids:exam_report_email_status' exam_id=exam.pk %}";
+ window.location = "{% url exam.app_name|add:':exam_report_email_status' exam_id=exam.pk %}";
})
})
diff --git a/generic/views.py b/generic/views.py
index 3e7883fa..885ec813 100644
--- a/generic/views.py
+++ b/generic/views.py
@@ -1497,11 +1497,14 @@ class ExamViews(View, LoginRequiredMixin):
by_question = defaultdict(dict)
unmarked = set()
+ cached_scores = True
+
if self.app_name in ("rapids"):
user_answers_callstates = defaultdict(list)
user_answers_callstates_counted = {}
if self.app_name in ("physics", "sbas"):
+ cached_scores = False
questions = exam.exam_questions.all()
else:
questions = exam.exam_questions.all().prefetch_related("answers")
@@ -1642,7 +1645,6 @@ class ExamViews(View, LoginRequiredMixin):
user_data[u]["callstates"] = str(counted_callstates)
user_answers_callstates_counted[u] = counted_callstates
- print(user_data)
exam.user_scores = user_data
@@ -1668,6 +1670,7 @@ class ExamViews(View, LoginRequiredMixin):
"median": median,
"mode": mode,
"plot": fig_html,
+ "cached_scores": cached_scores,
}
if self.app_name == "rapids":
@@ -1675,7 +1678,7 @@ class ExamViews(View, LoginRequiredMixin):
return render(
request,
- f"{self.app_name}/exam_scores_new.html",
+ f"{self.app_name}/exam_scores.html",
template_variables,
)
diff --git a/physics/templates/physics/exam_scores.html b/physics/templates/physics/exam_scores.html
index 5b8eb126..8718bee5 100644
--- a/physics/templates/physics/exam_scores.html
+++ b/physics/templates/physics/exam_scores.html
@@ -1,66 +1,23 @@
-{% extends 'physics/exams.html' %}
+{% extends 'generic/exam_scores_base.html' %}
-{% block content %}
-
-
{{ exam.name }}
-
-
-
-
Stats
- Candidates: {{cids|length}}
- Max score: {{max_score}}
- Mean: {{mean}}, Median {{median}}, Mode {{mode}}
-
-
-
Distribution of results
{{plot|safe}}
-
-
-
-
+{% block table_answers %}
+ {% for question in questions %}
- | Candidate ID |
- Score |
-
- {% for user, value in user_answers_marks.items %}
-
- | {{user}} |
- {{user_scores|get_item:user}} |
-
- {% endfor %}
-
-
-
-
Answers as a table
-
-
-
- | Candidate |
- {% for cid in cids %}
- {{cid}} |
- {% endfor %}
-
-
- {% for question in questions %}
-
- | Question {{forloop.counter}} |
- {% for zipped_answers in by_question|get_item:question %}
-
-
- {% for ans, score in zipped_answers %}
- - {{ans}}
- {% endfor %}
-
+ | Question {{forloop.counter}}
|
+ {% for cid in cids %}
+
+
+ {% with by_question|get_item:question|get_item:cid as ans_score %}
+ {% for ans, score in ans_score %}
+ - {{ans}}
+ {% endfor %}
+ {% endwith %}
+
+ |
{% endfor %}
- {% endfor %}
-
- | Score: |
- {% for score in user_scores_list %}
- {{score}} |
- {% endfor %}
-
-
+ {% endfor %}
+
+{% endblock %}
-
-{% endblock %}
\ No newline at end of file
diff --git a/physics/templates/physics/exam_scores_new.html b/physics/templates/physics/exam_scores_new.html
deleted file mode 100644
index 17c77290..00000000
--- a/physics/templates/physics/exam_scores_new.html
+++ /dev/null
@@ -1,73 +0,0 @@
-{% extends 'physics/exams.html' %}
-
-{% block content %}
- {{plot|safe}}
-
-
{{ exam.name }}
-
-
-
-
Stats
- Candidates: {{cids|length}}
- Max score: {{max_score}}
- Mean: {{mean}}, Median {{median}}, Mode {{mode}}
-
-
-
-
-
- | Candidate ID |
- Score |
- {% comment %} Normalised Score | {% endcomment %}
-
- {% comment %} {% for user, value in user_answers_marks.items %} {% endcomment %}
- {% for cid in cids %}
-
- | {{cid}} |
- {{user_scores|get_item:cid}} |
- {% comment %} {{user_scores_normalised|get_item:user}} | {% endcomment %}
-
- {% endfor %}
-
-
-
-
Answers as a table
-
-
-
- | Candidate |
- {% for cid in cids %}
- {{cid}} |
- {% comment %} {{cid}} | {% endcomment %}
- {% endfor %}
-
-
-
- {% for question in questions %}
-
- | Question {{forloop.counter}}
- |
- {% for cid in cids %}
-
-
- {% with by_question|get_item:question|get_item:cid as ans_score %}
- {% for ans, score in ans_score %}
- - {{ans}}
- {% endfor %}
- {% endwith %}
-
- |
- {% endfor %}
-
- {% endfor %}
-
- | Score: |
- {% for cid in cids %}
- {{user_scores|get_item:cid}} |
- {% endfor %}
-
-
-
-
-{% endblock %}
-
diff --git a/physics/urls.py b/physics/urls.py
index 3a8fd54f..daef603f 100644
--- a/physics/urls.py
+++ b/physics/urls.py
@@ -26,6 +26,10 @@ urlpatterns = [
name="exam_take_overview",
),
path("exam//", views.GenericExamViews.exam_overview, name="exam_overview"),
+ path("exam//report/email", views.GenericExamViews.exam_report_email, name="exam_report_email"),
+ path("exam//report/email/status", views.GenericExamViews.exam_report_email_status, name="exam_report_email_status"),
+ path("exam//report/", views.GenericExamViews.exam_user_report, name="exam_user_report"),
+ path("exam//report//email", views.GenericExamViews.exam_user_report_email, name="exam_user_report_email"),
path("exam//authors", views.ExamAuthorUpdate.as_view(), name="exam_authors"),
path(
"exam//scores",
diff --git a/rapids/templates/rapids/exam_scores.html b/rapids/templates/rapids/exam_scores.html
index 04b43d6f..bff599ad 100644
--- a/rapids/templates/rapids/exam_scores.html
+++ b/rapids/templates/rapids/exam_scores.html
@@ -1,79 +1,34 @@
-{% extends 'rapids/exams.html' %}
+{% extends 'generic/exam_scores_base.html' %}
-{% block content %}
- {{plot|safe}}
-
-
{{ exam.name }}
- User answer scores are cached, if you update or change an answer you will need to
refresh the scores.
-
- {% if unmarked %}
-
- The following questions need marking
- {% for exam_index in unmarked %}
-
{{ exam_index|add:1 }}
- {% endfor %}
-
-
- {% endif %}
-
-
-
-
Stats
- Candidates: {{cids|length}}
- Max score: {{max_score}}
- Mean: {{mean}}, Median {{median}}, Mode {{mode}}
-
-
-
-
-
- | Candidate ID |
- Score |
- Normalised Score |
-
- {% for user, value in user_answers_marks.items %}
-
- | {{user}} |
- {{user_scores|get_item:user}} |
- {{user_scores_normalised|get_item:user}} |
-
+{% block table_answers %}
+ {% for question in questions %}
+
+ | Question {{forloop.counter}}
+ {% if question.normal %}
+ [N]
+ {% else %}
+ [A]
+ {% endif %}
+ |
+ {% for cid in cids %}
+ {% with by_question|get_item:question|get_item:cid as ans_score %}
+ {{ans_score.0}} |
+ {% endwith %}
{% endfor %}
-
-
-
-
Answers as a table
-
-
-
- | Candidate |
- {% for cid in cids %}
- {{cid}} |
- {% endfor %}
+
+ {% endfor %}
-
-
- {% for question in questions %}
-
- | Question {{forloop.counter}}
- {% if question.normal %}
- [N]
- {% else %}
- [A]
- {% endif %}
- |
- {% for ans, score in by_question|get_item:question %}
- {{ans}} |
- {% endfor %}
-
- {% endfor %}
-
- | Score: |
- {% for score in user_scores_list %}
- {{score}} |
- {% endfor %}
-
-
-
-
-{% endblock %}
+{% endblock table_answers %}
+{% block breakdown %}
+
+ Call breakdown
+
+ {% for user, breakdown in user_answers_callstates.items %}
+ -
+ {{cids_user_id_map|get_item:user}} - {{breakdown}}
+
+ {% endfor %}
+
+
+{% endblock breakdown %}
\ No newline at end of file
diff --git a/sbas/templates/sbas/exam_scores.html b/sbas/templates/sbas/exam_scores.html
index 2ab22dc9..3217f19c 100644
--- a/sbas/templates/sbas/exam_scores.html
+++ b/sbas/templates/sbas/exam_scores.html
@@ -1,63 +1,21 @@
-{% extends 'sbas/exams.html' %}
+{% extends 'generic/exam_scores_base.html' %}
-{% block content %}
-
-
{{ exam.name }}
+{% block table_answers %}
-
-
-
Stats
- Candidates: {{cids|length}}
- Max score: {{max_score}}
- Mean: {{mean}}, Median {{median}}, Mode {{mode}}
-
-
-
Distribution of results
{{plot|safe}}
-
-
-
-
-
- | Candidate ID |
- Score |
-
- {% for user, value in user_answers_marks.items %}
-
- | {{user}} |
- {{user_scores|get_item:user}} |
-
- {% endfor %}
-
-
-
-
Results as a table
-
-
-
- | Candidate |
- {% for cid in cids %}
- {{cid}} |
- {% endfor %}
-
-
-
- {% for question in questions %}
-
- | Question {{forloop.counter}} |
- {% for ans, score in by_question|get_item:question %}
-
- {{ans}}
- |
+ {% for question in questions %}
+
+ | Question {{forloop.counter}}
+ |
+ {% comment %} {% for cid in cids %}
+ {{ans_by_question|get_item:question|get_item:cid}} |
+ {% endfor %} {% endcomment %}
+ {% for cid in cids %}
+ {% with by_question|get_item:question|get_item:cid as ans_score %}
+ {{ans_score.0}} |
+ {% endwith %}
+ {% endfor %}
+
{% endfor %}
-
- {% endfor %}
-
- | Score: |
- {% for score in user_scores_list %}
- {{score}} |
- {% endfor %}
-
-
-
-{% endblock %}
\ No newline at end of file
+{% endblock %}
+
diff --git a/sbas/templates/sbas/exam_scores_new.html b/sbas/templates/sbas/exam_scores_new.html
deleted file mode 100644
index d0afab9f..00000000
--- a/sbas/templates/sbas/exam_scores_new.html
+++ /dev/null
@@ -1,70 +0,0 @@
-{% extends 'sbas/exams.html' %}
-
-{% block content %}
- {{plot|safe}}
-
-
{{ exam.name }}
-
-
-
-
Stats
- Candidates: {{cids|length}}
- Max score: {{max_score}}
- Mean: {{mean}}, Median {{median}}, Mode {{mode}}
-
-
-
-
-
- | Candidate ID |
- Score |
- {% comment %} Normalised Score | {% endcomment %}
-
- {% comment %} {% for user, value in user_answers_marks.items %} {% endcomment %}
- {% for cid in cids %}
-
- | {{cid}} |
- {{user_scores|get_item:cid}} |
- {% comment %} {{user_scores_normalised|get_item:user}} | {% endcomment %}
-
- {% endfor %}
-
-
-
-
Answers as a table
-
-
-
- | Candidate |
- {% for cid in cids %}
- {{cid}} |
- {% comment %} {{cid}} | {% endcomment %}
- {% endfor %}
-
-
-
- {% for question in questions %}
-
- | Question {{forloop.counter}}
- |
- {% comment %} {% for cid in cids %}
- {{ans_by_question|get_item:question|get_item:cid}} |
- {% endfor %} {% endcomment %}
- {% for cid in cids %}
- {% with by_question|get_item:question|get_item:cid as ans_score %}
- {{ans_score.0}} |
- {% endwith %}
- {% endfor %}
-
- {% endfor %}
-
- | Score: |
- {% for cid in cids %}
- {{user_scores|get_item:cid}} |
- {% endfor %}
-
-
-
-
-{% endblock %}
-
diff --git a/sbas/urls.py b/sbas/urls.py
index 43b500e7..f25dd7be 100644
--- a/sbas/urls.py
+++ b/sbas/urls.py
@@ -26,6 +26,10 @@ urlpatterns = [
name="exam_take_overview",
),
path("exam//", views.GenericExamViews.exam_overview, name="exam_overview"),
+ path("exam//report/email", views.GenericExamViews.exam_report_email, name="exam_report_email"),
+ path("exam//report/email/status", views.GenericExamViews.exam_report_email_status, name="exam_report_email_status"),
+ path("exam//report/", views.GenericExamViews.exam_user_report, name="exam_user_report"),
+ path("exam//report//email", views.GenericExamViews.exam_user_report_email, name="exam_user_report_email"),
path("exam//authors", views.ExamAuthorUpdate.as_view(), name="exam_authors"),
path(
"exam//scores",