Fix reservation ticket counters#436
Conversation
|
Hello! I noticed a minor N+1 performance issue. |
|
Hi! Thanks for catching that 🙏 Fixed the N+1 by adding an annotation in This computes both counts for all reservations in a single query instead of two queries per reservation. I kept the existing Also added a regression test that builds the same annotated queryset and asserts it matches the model methods' output on a mixed set of ticket statuses, so any future drift between the two would be caught by CI. Updated Let me know if you'd prefer a different approach! |
Summary
Fix reservation ticket counters displayed in the account reservations page.
Changes
valid_tickets_countcancelled_tickets_countTests