Add candidate count method to ExamOrCollectionGenericBase and update exam list template
This commit is contained in:
@@ -1002,6 +1002,9 @@ class ExamOrCollectionGenericBase(models.Model, AuthorMixin):
|
||||
def add_marker(self, user):
|
||||
self.markers.add(user)
|
||||
|
||||
def get_candidate_count(self):
|
||||
return self.valid_cid_users.count() + self.valid_user_users.count()
|
||||
|
||||
|
||||
class ExamBase(ExamOrCollectionGenericBase):
|
||||
exam_mode = models.BooleanField(
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</a>
|
||||
<small class="ms-2 text-muted">
|
||||
<span class="badge bg-secondary">Questions: {{ exam.get_questions|length }}</span>
|
||||
<span class="badge bg-secondary ms-1">Candidates: {{ exam.stats_candidates|default:0|floatformat:0 }}</span>
|
||||
<span class="badge bg-secondary ms-1">Candidates: {{ exam.get_candidate_count }}</span>
|
||||
</small>
|
||||
</h5>
|
||||
<small class="text-muted">Authors: {{ exam.get_authors }}</small>
|
||||
|
||||
Reference in New Issue
Block a user