Commit 5390a4f
authored
fix: annotate conference list with has_errors, has_warnings, participants_count (#22)
* fix: annotate conference list with has_errors, has_warnings, participants_count
After expand_fields was removed (PR #19), the conference list no longer
includes participants or issues arrays. This broke the dashboard charts
for error/warning icons and participant counts.
Adds lightweight annotations via Exists() subqueries and Count() so the
list includes:
- has_errors (boolean)
- has_warnings (boolean)
- participants_count (integer)
No N+1 queries — all computed in the same SQL query.
* fix: use Subquery for participants_count to avoid filtered join bug
Count('participants') reuses the filtered JOIN when participantId is in
the query string, returning 1 instead of the real total. Switched to a
Subquery that counts independently of the request's participant filter.
Addresses review feedback from Codex and Alberto.
* fix: exclude soft-deleted participants from participants_count
The Subquery used Participant.objects.filter() which bypasses the
is_active=True check, overcounting if any participants were soft-deleted.1 parent a182209 commit 5390a4f
1 file changed
Lines changed: 24 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
43 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
44 | 63 | | |
45 | 64 | | |
46 | 65 | | |
47 | 66 | | |
48 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
49 | 71 | | |
50 | 72 | | |
51 | 73 | | |
| |||
0 commit comments