Skip to content

WAIT-AMYBE NOT: Add unallocated direct payments to the dashboard equation#1843

Draft
maebeale wants to merge 1 commit into
mainfrom
maebeale/rebase-main-fix-ci
Draft

WAIT-AMYBE NOT: Add unallocated direct payments to the dashboard equation#1843
maebeale wants to merge 1 commit into
mainfrom
maebeale/rebase-main-fix-ci

Conversation

@maebeale

Copy link
Copy Markdown
Collaborator

What is the goal of this PR and why is this important?

  • The event dashboard's grand-total equation already surfaces unallocated bulk payments — bulk-payment money received but not yet applied to a registration.
  • Direct (non-bulk) payments with a leftover balance (e.g. a registrant who overpaid) were invisible, so the equation understated the cash on hand for the event.
  • This adds a parallel Unallocated direct payments term so the dashboard reflects all unapplied money.

How did you approach the change?

  • Added EventDashboard#unallocated_direct_payment_cents mirroring unallocated_bulk_payment_cents, and folded it into grand_total_cents.
  • Scoped it via a private direct_payments: payments that source an allocation to one of the event's active registrations, with amount_cents_remaining > 0, excluding bulk payments so their remainder is never double-counted.
  • Added an amber equation box (same treatment as the bulk term) to events/dashboard.html.erb, shown only when the figure is positive, linking to the payments index filtered to unallocated payments (payments_path(has_remaining: "yes")). Updated the mobile equation label too.
  • Added service specs (sum, grand-total inclusion, full-applied/other-event/inactive exclusions, no bulk double-count) and request specs (term renders + links to the filtered index; omitted when fully applied).

Anything else to add?

  • Open decision (why this is WAIT): the link target is the global payments index (has_remaining=yes), not event-scoped — the payments index has no event filter, so the list it opens shows unallocated payments across all events while the dashboard figure is this-event-only. The number and the list won't be a perfect 1:1. If we want them to agree, we'd add an event filter to Payment.search_by_params.
  • While testing, noted the shared dashboard fixtures set amount_cents_remaining to the full amount on fully-allocated payments; the Allocation after_create callback already decrements that to 0, so values were harmless before but now feed the new figure — left them as realistic full-amount values and let the callback do the math.

🤖 Generated with Claude Code

The grand-total equation already surfaced bulk-payment money still
waiting to be applied. Direct (non-bulk) payments with a leftover
balance — e.g. an overpaying registrant — were invisible, so the
equation understated cash on hand. Add a parallel term beside the bulk
one that links to the payments index filtered to unallocated payments.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@maebeale maebeale changed the title WAIT: Add unallocated direct payments to the dashboard equation WAIT-AMYBE NOT: Add unallocated direct payments to the dashboard equation Jun 28, 2026
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