feat: Enhance case conversation display with detailed message stats and loading indicator

This commit is contained in:
Ross
2026-04-27 21:45:27 +01:00
parent 0b1f842e31
commit d4f25de9d3
2 changed files with 24 additions and 7 deletions
@@ -290,13 +290,25 @@
</form>
{% if question_completed %}
<div class="mt-3"
hx-get="{% url 'atlas:collection_case_review_thread' exam_id=collection.id cid_user_exam_id=cid_user_exam.id case_id=case.id %}{% if cid %}?cid={{ cid }}&passcode={{ passcode }}{% endif %}"
hx-trigger="load"
hx-target="this"
hx-swap="innerHTML">
<div class="small text-muted">Loading case conversation...</div>
</div>
<details class="mt-3" {% if case_review_stats.has_outstanding_any %}open{% endif %}>
<summary class="small fw-semibold d-flex flex-wrap align-items-center gap-2">
<span>Case conversation</span>
{% if case_review_stats.has_outstanding_any %}
<span class="badge bg-danger">{{ case_review_stats.outstanding_total_count }} unacknowledged message{{ case_review_stats.outstanding_total_count|pluralize }}</span>
{% elif case_review_stats.has_messages %}
<span class="badge bg-secondary">{{ case_review_stats.message_count }} message{{ case_review_stats.message_count|pluralize }}</span>
{% else %}
<span class="text-muted">No messages yet</span>
{% endif %}
</summary>
<div class="mt-2"
hx-get="{% url 'atlas:collection_case_review_thread' exam_id=collection.id cid_user_exam_id=cid_user_exam.id case_id=case.id %}{% if cid %}?cid={{ cid }}&passcode={{ passcode }}{% endif %}"
hx-trigger="load"
hx-target="this"
hx-swap="innerHTML">
<div class="small text-muted">Loading case conversation...</div>
</div>
</details>
{% endif %}
<aside id="selfReviewSidebar" class="self-review-sidebar" aria-live="polite" aria-label="Self review sidebar">
+5
View File
@@ -5863,6 +5863,10 @@ def collection_case_view_take(
# Determine whether any prior series will be shown to the candidate.
has_priors = any(prior_flag for (_, prior_flag, _) in series_to_load)
prior_count = prior_cases.count()
case_review_stats, _, _ = _get_case_review_stats_for_exam(
cid_user_exam=cid_user_exam,
casedetails=[casedetail],
)
return render(
request,
"atlas/collection_case_view_take.html",
@@ -5888,6 +5892,7 @@ def collection_case_view_take(
"show_report": show_report,
"resources": resources,
"cid_user_exam": cid_user_exam,
"case_review_stats": case_review_stats.get(casedetail.case_id, {}),
"question_completed": question_completed,
"self_review": self_review,
"answer_started_at_iso": answer.started_at.isoformat() if answer and getattr(answer, 'started_at', None) else None,