Enhance submitted candidates display by adding dynamic exam status indicators and improving badge tooltip functionality for better user feedback.
This commit is contained in:
@@ -2347,6 +2347,25 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
.order_by("start_time")
|
||||
)
|
||||
|
||||
# Determine which submitted entries correspond to candidates/users
|
||||
# that are actually added to the exam so we can highlight those that
|
||||
# are not. Collect valid IDs once to avoid per-row queries.
|
||||
valid_cid_pks = set(exam.valid_cid_users.values_list("pk", flat=True))
|
||||
valid_user_pks = set(exam.valid_user_users.values_list("pk", flat=True))
|
||||
|
||||
for ue in user_exam_data:
|
||||
in_exam = False
|
||||
try:
|
||||
if ue.cid_user_id and ue.cid_user_id in valid_cid_pks:
|
||||
in_exam = True
|
||||
if ue.user_user_id and ue.user_user_id in valid_user_pks:
|
||||
in_exam = True
|
||||
except Exception:
|
||||
in_exam = False
|
||||
|
||||
# Attach a dynamic attribute the template can read
|
||||
setattr(ue, "in_exam", in_exam)
|
||||
|
||||
return render(
|
||||
request,
|
||||
"generic/partials/exam_cids_submitted_list.html",
|
||||
|
||||
Reference in New Issue
Block a user