Enhance ExamCollectionDetail queryset to prefetch related exams and annotate candidate counts for improved performance in templates
This commit is contained in:
@@ -17,9 +17,24 @@
|
||||
{% if app_name == 'anatomy' %}<a href="{% url 'anatomy:mark2_overview' pk=exam.pk %}" class="flex-col-half">Mark2</a>{% endif %}
|
||||
{% endif %}
|
||||
<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>
|
||||
<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">
|
||||
{% if exam.valid_cid_users_count is not None %}
|
||||
{{ exam.valid_cid_users_count }}
|
||||
{% else %}
|
||||
{{ exam.valid_cid_users.count }}
|
||||
{% endif %}
|
||||
</span>
|
||||
/
|
||||
<span title="Number of active User users">
|
||||
{% if exam.valid_user_users_count is not None %}
|
||||
{{ exam.valid_user_users_count }}
|
||||
{% else %}
|
||||
{{ exam.valid_user_users.count }}
|
||||
{% endif %}
|
||||
]</span>
|
||||
</span>
|
||||
</span>
|
||||
<a href="{% url app_name|add:':exam_scores_all' pk=exam.pk %}" class="flex-col-half">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 %}>
|
||||
|
||||
Reference in New Issue
Block a user