improve exam_list view

This commit is contained in:
Ross
2023-12-11 10:31:22 +00:00
parent ee013b6dbd
commit 055840b6a4
2 changed files with 14 additions and 3 deletions
+1 -1
View File
@@ -640,7 +640,7 @@ class ExamViews(View, LoginRequiredMixin):
"name" "name"
) )
else: else:
exam_list = self.Exam.objects.all().order_by("name") exam_list = self.Exam.objects.prefetch_related("valid_user_users", "valid_cid_users").all().order_by("name")
if not all: if not all:
exam_list = exam_list.filter(exam_mode=True, archive=False).order_by("name") exam_list = exam_list.filter(exam_mode=True, archive=False).order_by("name")
+13 -2
View File
@@ -11,7 +11,9 @@
<a href="{% url app_name|add:':exam_overview' pk=exam.pk %}" class="flex-col-2 exam-name">{{exam.name}}</a> <a href="{% url app_name|add:':exam_overview' pk=exam.pk %}" class="flex-col-2 exam-name">{{exam.name}}</a>
{% if marking %}<a href="{% url app_name|add:':mark_overview' pk=exam.pk %}" class="flex-col">Mark</a>{% endif %} {% if marking %}<a href="{% url app_name|add:':mark_overview' pk=exam.pk %}" class="flex-col">Mark</a>{% endif %}
<span class="flex-col"> <span class="flex-col">
<a href="{% url app_name|add:':exam_cids' exam_id=exam.pk %}">Candidates</a> <span class="candidate-counts">[{{exam.valid_cid_users.count}} / {{exam.valid_user_users.count}}]</span> <a href="{% url app_name|add:':exam_cids' exam_id=exam.pk %}">Candidates</a> <span class="candidate-counts">[<span title="Number of active CID users">
{{exam.valid_cid_users.count}}
</span> / <span title="Number of active User users">{{exam.valid_user_users.count}}]</span></span>
</span> </span>
<a href="{% url app_name|add:':exam_scores_all' pk=exam.pk %}" class="flex-col">Scores</a> <a href="{% url app_name|add:':exam_scores_all' pk=exam.pk %}" class="flex-col">Scores</a>
<input type="checkbox" id="active-{{exam.pk}}" class="exam-active-switch" data-posturl="{% url app_name|add:':exam_toggle_active' pk=exam.pk %}" {% if exam.active %}checked{% endif %}> <input type="checkbox" id="active-{{exam.pk}}" class="exam-active-switch" data-posturl="{% url app_name|add:':exam_toggle_active' pk=exam.pk %}" {% if exam.active %}checked{% endif %}>
@@ -34,7 +36,16 @@
<li class="exam-item"> <li class="exam-item">
<a href="{% url app_name|add:':exam_overview' pk=exam.pk %}" class="flex-col-2 exam-name">{{exam.name}}</a> <a href="{% url app_name|add:':exam_overview' pk=exam.pk %}" class="flex-col-2 exam-name">{{exam.name}}</a>
{% if marking %}<a href="{% url app_name|add:':mark_overview' pk=exam.pk %}" class="flex-col">Mark</a>{% endif %} {% if marking %}<a href="{% url app_name|add:':mark_overview' pk=exam.pk %}" class="flex-col">Mark</a>{% endif %}
<a href="{% url app_name|add:':exam_cids' exam_id=exam.pk %}" class="flex-col">Candidates</a> <span class="flex-col">
<a href="{% url app_name|add:':exam_cids' exam_id=exam.pk %}">Candidates</a>
<span class="candidate-counts">
[<span title="Number of active CID users">{{exam.valid_cid_users.count}}</span>
/
<span title="Number of active User users">{{exam.valid_user_users.count}}]
</span>
</span>
</span>
<a href="{% url app_name|add:':exam_scores_all' pk=exam.pk %}" class="flex-col">Scores</a> <a href="{% url app_name|add:':exam_scores_all' pk=exam.pk %}" class="flex-col">Scores</a>
<input type="checkbox" id="active-{{exam.pk}}" class="exam-active-switch" data-posturl="{% url app_name|add:':exam_toggle_active' pk=exam.pk %}" {% if exam.active %}checked{% endif %}> <input type="checkbox" id="active-{{exam.pk}}" class="exam-active-switch" data-posturl="{% url app_name|add:':exam_toggle_active' pk=exam.pk %}" {% if exam.active %}checked{% endif %}>
<label for="active-{{exam.pk}}" class="flex-col icon-container active-icon" title="Click to toggle active state">Exam Active</label> <label for="active-{{exam.pk}}" class="flex-col icon-container active-icon" title="Click to toggle active state">Exam Active</label>