Skip to content

Conversation

@stefan-burke
Copy link
Member

Summary

This PR adds revenue tracking functionality to the admin events page, allowing event organizers to see the total revenue generated from ticket sales.

Changes

  • New calculateTotalRevenue function: Computes total revenue in cents from attendees by:

    • Summing price_paid values when available
    • Falling back to unit_price * quantity for attendees without explicit pricing
    • Handling edge cases like null unit prices and non-numeric price values
  • New formatRevenue helper: Converts cents to a human-readable decimal format (e.g., 1000 cents → "10.00")

  • UI enhancement: Displays total revenue on the admin event details page, but only for paid events (when unit_price is not null)

  • Comprehensive test coverage: Added 11 new tests covering:

    • Empty attendee lists
    • Price paid summation
    • Unit price fallback calculation
    • Mixed pricing scenarios
    • Invalid/missing data handling
    • UI rendering for both paid and free events

Implementation Details

  • Revenue is stored and calculated in cents to avoid floating-point precision issues
  • The calculation gracefully handles missing or invalid price_paid values by falling back to the unit price calculation
  • The revenue display is conditionally rendered only for events with a defined unit price, keeping the UI clean for free events

https://claude.ai/code/session_013tY9Yv4MsSbzieu8LS89aR

claude and others added 3 commits February 2, 2026 02:02
Shows total revenue for paid events by summing attendee price_paid values,
falling back to unit_price * quantity when price_paid is not set.

https://claude.ai/code/session_013tY9Yv4MsSbzieu8LS89aR
price_paid is always set when unit_price is set, so the fallback to
unit_price * quantity is unnecessary. Simplifies both calculateTotalRevenue
and the webhook buildWebhookPayload.

https://claude.ai/code/session_013tY9Yv4MsSbzieu8LS89aR
@stefan-burke stefan-burke added this pull request to the merge queue Feb 2, 2026
Merged via the queue into main with commit 61ea594 Feb 2, 2026
2 checks passed
@stefan-burke stefan-burke deleted the claude/add-event-revenue-3MTrq branch February 2, 2026 02:25
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.

3 participants