Start using start dates for exams
This commit is contained in:
+8
-3
@@ -869,6 +869,14 @@ class ExamBase(ExamOrCollectionGenericBase):
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
def __str__(self):
|
||||
print("TESTING")
|
||||
if self.start_date and self.start_date is not None:
|
||||
print(f"Start date: {self.start_date:%d %B %Y}")
|
||||
return f"{self.name} ({self.start_date:%d %B %Y})"
|
||||
else:
|
||||
return self.name
|
||||
|
||||
def save(self, *args, recreate_json=True, **kwargs):
|
||||
self.recreate_json = recreate_json
|
||||
|
||||
@@ -903,9 +911,6 @@ class ExamBase(ExamOrCollectionGenericBase):
|
||||
"""
|
||||
return text
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse("{}:exam_overview".format(self.app_name), kwargs={"pk": self.pk})
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
{% else %}
|
||||
Packet:
|
||||
{% endif %}
|
||||
{{ exam.name }} </a></h1>
|
||||
{{ exam }} </a></h1>
|
||||
<span class="authors">Authors: {{exam.get_authors}}</span>
|
||||
{% if exam.exam_mode %}
|
||||
{% if app_name in "rapids longs anatomy" %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% include "generic/exam_link_headers.html" %}
|
||||
<h1>Exam: {{ exam.name }}</h1>
|
||||
<h1>Exam: {{ exam }}</h1>
|
||||
|
||||
{% include 'exam_notes.html' %}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
{% block content %}
|
||||
<div class="">
|
||||
<h2>{{ exam.name }}</h2>
|
||||
<h2>{{ exam }}</h2>
|
||||
{% if cached_scores %}
|
||||
User answer scores are cached, if you update or change an answer you will need to <a href="{% url exam.app_name|add:':exam_scores_refresh' exam.pk %}">refresh the scores</a>.
|
||||
{% endif %}
|
||||
|
||||
+3
-7
@@ -556,7 +556,7 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
data = {
|
||||
"status": "success",
|
||||
"archive": exam.archive,
|
||||
"name": exam.name,
|
||||
"name": exam,
|
||||
"id": exam.id,
|
||||
}
|
||||
return JsonResponse(data, status=200)
|
||||
@@ -580,7 +580,7 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
data = {
|
||||
"status": "success",
|
||||
"publish_results": exam.publish_results,
|
||||
"name": exam.name,
|
||||
"name": exam,
|
||||
"id": exam.id,
|
||||
}
|
||||
return JsonResponse(data, status=200)
|
||||
@@ -602,7 +602,7 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
data = {
|
||||
"status": "success",
|
||||
"active": exam.active,
|
||||
"name": exam.name,
|
||||
"name": exam,
|
||||
"id": exam.id,
|
||||
}
|
||||
return JsonResponse(data, status=200)
|
||||
@@ -1483,13 +1483,9 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
exam: ExamBase
|
||||
for exam in exams:
|
||||
if exam.active or self.check_user_access(request.user, exam.pk):
|
||||
print(
|
||||
f"{exam.app_name=}, {exam.name=}, {cid=}, {passcode=}, {request.user=}"
|
||||
)
|
||||
if exam.exam_mode and not exam.check_cid_user(
|
||||
cid, passcode, user=request.user, user_id=request.user.pk
|
||||
):
|
||||
print(exam.name, "fail")
|
||||
continue
|
||||
|
||||
if exam.json_creation_time:
|
||||
|
||||
Reference in New Issue
Block a user