Add total revenue calculation and display for paid events #154
+79
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
calculateTotalRevenuefunction: Computes total revenue in cents from attendees by:price_paidvalues when availableunit_price * quantityfor attendees without explicit pricingNew
formatRevenuehelper: 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_priceis not null)Comprehensive test coverage: Added 11 new tests covering:
Implementation Details
price_paidvalues by falling back to the unit price calculationhttps://claude.ai/code/session_013tY9Yv4MsSbzieu8LS89aR