Skip to content

feat(registrations): revenue and average order cards on the Registration page - #528

Merged
harshtandiya merged 2 commits into
developfrom
feat/registration-revenue-cards
Oct 3, 2026
Merged

harshtandiya merged 2 commits into
developfrom
feat/registration-revenue-cards

Conversation

@harshtandiya

Copy link
Copy Markdown
Collaborator

What changed

The Registration page gets Revenue and Average order cards above Ticket Types. get_event_ticket_types now returns revenue: one row per currency with collected, refunded, bookings and tickets. Rows come from paid, submitted bookings with a non-zero total. The gate is the existing ensure_event_team_access, so only team members see it.

  • Offline bookings awaiting approval are already submitted (docstatus=1), so payment_status="Paid" is the filter that keeps them out of revenue. Free bookings are left out too, so they don't drag down the average.
  • Ticket counts are a separate query. Joining tickets into the sum query would multiply each booking's total by its ticket count.
  • Currencies are never added together. The currency with the most bookings is the reading; the others go in the Revenue caption ("+ $1,815"), next to the refunded amount.
  • Revenue = collected − refunded. Average order = collected ÷ bookings, with "N tickets per booking" under it. No cards on an event with no paid bookings.

Separate commit: price rows in the ticket type drawer line up. A locked currency row has no remove button, so it now keeps that button's width. Rows are also 8px apart instead of 2px. PerkList shares the component.

Not changed: a booking cancelled without a refund drops out of revenue (docstatus=2) even though the money was kept. Event Booking.event and Event Ticket.booking have no index, so these queries scan both tables, like the existing tickets_sold_by_type already does. Indexing is left for a follow-up.

Demo

Revenue and average order cards Locked INR row lined up with a new row

Testing

Checks: test_ticket_types (9, 4 new in TestRegistrationRevenue) green on testbuzz. Removing the paid/free/cancelled filters makes the new tests fail. Typecheck and pre-commit clean. Not run: E2E, other test modules.

…ion page

get_event_ticket_types returns revenue per currency: amount collected,
refunded, bookings and tickets, from paid, submitted bookings with a
non-zero total. Offline bookings awaiting approval and free bookings are
left out.
A row without a remove button (a locked currency) now keeps that
button's width, so its fields match the other rows.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@harshtandiya
harshtandiya merged commit b7bc771 into develop Oct 3, 2026
8 checks passed
@harshtandiya
harshtandiya deleted the feat/registration-revenue-cards branch October 3, 2026 18:21
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