Skip to content

feat: add global ticket capacity for conferences#32

Merged
JacobCoffee merged 4 commits intomainfrom
feat/global-capacity
Feb 14, 2026
Merged

feat: add global ticket capacity for conferences#32
JacobCoffee merged 4 commits intomainfrom
feat/global-capacity

Conversation

@JacobCoffee
Copy link
Owner

Summary

  • Adds total_capacity field on Conference model (0 = unlimited, matching TicketType.total_quantity convention)
  • New registration/services/capacity.py with get_global_sold_count(), get_global_remaining(), and validate_global_capacity()
  • Enforced at cart-add, update-quantity, and checkout revalidation (add-ons excluded from count)
  • Supported in bootstrap command, admin, manage UI (capacity banner + form field), and example TOML

Test plan

  • Unit tests for all 3 capacity functions (empty, paid/refunded/pending counting, add-on exclusion, no-limit bypass, over-cap error)
  • Cart integration: add_ticket respects/bypasses global cap, update_quantity respects cap, multi-ticket-type cap
  • Checkout integration: revalidation catches oversell between cart-add and checkout
  • Bootstrap with/without total_capacity
  • TicketTypeListView context includes/excludes global capacity info
  • All 1191 tests pass, lint/format/type-check clean

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings February 14, 2026 03:17
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py to 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.

JacobCoffee and others added 2 commits February 13, 2026 21:57
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>
Copilot AI review requested due to automatic review settings February 14, 2026 04:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@JacobCoffee JacobCoffee merged commit 4b5b81a into main Feb 14, 2026
16 checks passed
@JacobCoffee JacobCoffee deleted the feat/global-capacity branch February 14, 2026 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant