feat: add global ticket capacity for conferences#32
Conversation
Venue-level cap (total_capacity on Conference) limits total tickets sold across all ticket types. Enforced at cart-add, update-quantity, and checkout revalidation. Add-ons excluded from count. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
Adds a conference-wide “global” ticket capacity (Conference.total_capacity) and enforces it across the registration flow (cart add/update + checkout revalidation), with corresponding admin/manage UI support and bootstrap config wiring.
Changes:
- Introduces
Conference.total_capacity(0 = unlimited) with migration, admin/manage form + template updates, and TOML bootstrap support. - Adds
registration/services/capacity.pyto compute sold/remaining and validate requests against the global cap. - Integrates global-cap validation into cart and checkout flows, and adds unit + integration tests covering the new behavior.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_registration/test_checkout_service.py | Adds checkout-level integration test to ensure global capacity is revalidated during checkout. |
| tests/test_registration/test_cart_service.py | Adds cart integration tests for add/update quantity enforcement under a global cap. |
| tests/test_registration/test_capacity.py | New unit tests for global capacity counting/remaining/validation helpers. |
| tests/test_manage/test_views.py | Adds manage view tests for including/excluding global capacity info in context. |
| tests/test_manage/test_forms.py | Ensures total_capacity is included in conference manage form fields and accepts valid input. |
| tests/test_conference/test_bootstrap_command.py | Adds bootstrap tests to set/default total_capacity from TOML config. |
| src/django_program/registration/services/checkout.py | Adds checkout revalidation helper for global capacity. |
| src/django_program/registration/services/cart.py | Enforces global capacity during add_ticket and update_quantity; adds cart ticket-qty aggregation helper. |
| src/django_program/registration/services/capacity.py | New service module implementing sold count / remaining / validation. |
| src/django_program/manage/views.py | Exposes global capacity + sold count in ticket type list view context when enabled. |
| src/django_program/manage/templates/django_program/manage/ticket_type_list.html | Displays a capacity banner when global capacity is set. |
| src/django_program/manage/templates/django_program/manage/conference_edit.html | Adds a “Capacity” fieldset with total_capacity form field. |
| src/django_program/manage/forms.py | Adds total_capacity to conference manage form Meta fields. |
| src/django_program/conference/models.py | Adds total_capacity field to Conference model (0 = unlimited). |
| src/django_program/conference/migrations/0004_add_total_capacity.py | Migration to add total_capacity to the Conference table. |
| src/django_program/conference/management/commands/bootstrap_conference.py | Maps TOML total_capacity into conference creation/update. |
| src/django_program/conference/admin.py | Adds total_capacity to admin fieldset for Conference. |
| conference.example.toml | Documents total_capacity in the example configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add tests for two uncovered lines that caused the coverage CI job to fail: the unauthenticated user early-return in ActivityOrganizerMixin dispatch (views.py:1570) and the addon-only early-return in _revalidate_global_capacity (checkout.py:374). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…DB query Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…hecks Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
total_capacityfield onConferencemodel (0 = unlimited, matchingTicketType.total_quantityconvention)registration/services/capacity.pywithget_global_sold_count(),get_global_remaining(), andvalidate_global_capacity()Test plan
🤖 Generated with Claude Code