Skip to content

Exclude unapplied scholarships from the event grand total#1580

Merged
maebeale merged 1 commit into
mainfrom
maebeale/fix-scholarship-total-applied
Jun 6, 2026
Merged

Exclude unapplied scholarships from the event grand total#1580
maebeale merged 1 commit into
mainfrom
maebeale/fix-scholarship-total-applied

Conversation

@maebeale

@maebeale maebeale commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

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

  • EventDashboard#grand_total_cents could exceed the full-price total_cents and show scholarship dollars that were never actually applied.
  • Root cause: an outstanding scholarship (tasks not yet completed) has its allocation amount forced to 0 by Scholarship#sync_allocation_amount, so that registration's full cost still sits in outstanding_cents. grand_total_cents also added the awarded amount via scholarship_total_cents, double-counting the same cost.
  • Surfaced by a Copilot review comment on the dashboard overview.

How did you approach the change?

  • Added a private applied_scholarship_cents that sums only scholarship allocation amounts (zero for outstanding scholarships), and used it in grand_total_cents.
  • Deliberately left scholarship_total_cents as the awarded amount: the dashboard scholarship card headline must equal its Completed + Incomplete breakdown, so it can't become applied-only (which is why Copilot's literal suggestion was adjusted rather than applied as-is).
  • Used the allocation amount (not completed_scholarship_cents) because existing fixtures can have an applied allocation while tasks_completed is still false — the allocation is the source of truth for what's been applied.

UI Testing Checklist

  • Open an event dashboard with an outstanding scholarship (awarded, tasks incomplete): grand total no longer exceeds the full-price total.
  • Scholarship card headline still equals Completed + Incomplete.

Anything else to add?

  • TDD: added a failing spec (with an outstanding (unapplied) scholarship) asserting grand_total_cents == total_cents and that the headline still equals completed + outstanding, then made it pass. Full event_dashboard_spec green (36 examples).
  • No migration or schema change.

🤖 Generated with Claude Code

Outstanding scholarships (tasks not yet completed) force their allocation
amount to 0, so the registration's full cost still sits in outstanding_cents.
grand_total_cents was also adding the awarded amount via scholarship_total_cents,
double-counting that cost and pushing the grand total above the full-price
total_cents. Add only applied scholarship allocations to the grand total.

scholarship_total_cents stays the awarded amount because the dashboard
scholarship card headline must equal its Completed + Incomplete breakdown.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 6, 2026 21:49
# grand total above total_cents.
def grand_total_cents
registration_subtotal_cents + scholarship_total_cents + cont_ed_total_cents
registration_subtotal_cents + applied_scholarship_cents + cont_ed_total_cents

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

🤖 From Claude: Used applied_scholarship_cents (allocation amounts) here rather than Copilot's suggested change to scholarship_total_cents — the card headline must stay the awarded total to match its Completed + Incomplete breakdown. Allocation amount, not completed_scholarship_cents, since fixtures can have an applied allocation while tasks_completed is still false.

@maebeale maebeale marked this pull request as ready for review June 6, 2026 21:49

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maebeale maebeale merged commit 422c846 into main Jun 6, 2026
3 of 4 checks passed
@maebeale maebeale deleted the maebeale/fix-scholarship-total-applied branch June 6, 2026 22:15
maebeale added a commit that referenced this pull request Jun 6, 2026
Wire every dashboard money/headcount card color through DomainTheme instead
of hard-coded Tailwind utilities, so the dashboard stays in step with the
app-wide palette. Adds the missing keys (payments, scholarships,
continuing_education, event_dashboard, addresses) and extends the Tailwind
safelist with the hover border/text variants the helpers now generate.

Clarify the scholarship card: the headline is the full amount "potentially
awarded", with the allocated portion ("awarded", tasks complete) surfaced
separately since only that flows into the grand total. Registration fees and
cont ed headlines gain an "including due" caveat so the figures aren't read as
cash-collected.

Grand total counts allocated_scholarship_cents (renamed from
completed_scholarship_cents) rather than #1580's raw applied-allocation sum:
the awarded amount of allocated scholarships is the meaningful figure and
matches the "Completed & allocated" amount the dashboard shows, keeping the
equation internally consistent.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
maebeale added a commit that referenced this pull request Jun 7, 2026
)

* Theme event dashboard cards and count only allocated scholarships

Wire every dashboard money/headcount card color through DomainTheme instead
of hard-coded Tailwind utilities, so the dashboard stays in step with the
app-wide palette. Adds the missing keys (payments, scholarships,
continuing_education, event_dashboard, addresses) and extends the Tailwind
safelist with the hover border/text variants the helpers now generate.

Clarify the scholarship card: the headline is the full amount "potentially
awarded", with the allocated portion ("awarded", tasks complete) surfaced
separately since only that flows into the grand total. Registration fees and
cont ed headlines gain an "including due" caveat so the figures aren't read as
cash-collected.

Grand total counts allocated_scholarship_cents (renamed from
completed_scholarship_cents) rather than #1580's raw applied-allocation sum:
the awarded amount of allocated scholarships is the meaningful figure and
matches the "Completed & allocated" amount the dashboard shows, keeping the
equation internally consistent.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Refine event dashboard money cards, labels, and drill-downs

- Collapse each money card (Registration fees / Scholarships / Continuing
  education fees) into a chevron-expandable details: it shows just the total
  by default and expands to Paid/Due (or Completed & allocated / Incomplete &
  unallocated) sub-rows, which in turn expand to per-registrant lists with
  per-person amounts.
- Add a Collected / Due / Monies cash summary beside the grand total
  (collected + due = monies; scholarships are excluded since they're awarded,
  not collected).
- Clarify scholarship copy ("including unallocated"; "Completed & allocated" /
  "Incomplete & unallocated") and rename "Cont ed fees" to "Continuing
  education fees".
- Registrant names now jump to the manage list filtered to that one person,
  with a name + organization tooltip, instead of the profile page.
- "<n> inactive" links to the matching manage list with a jump icon.
- Wrap the addend cards on smaller screens.

Backed by EventDashboard methods (collected/due/monies_made_cents,
inactive_registrant_ids, organization_names_by_registrant, and the per-recipient
/ per-registrant breakdown maps) with specs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Add dev scholarship seeds

- New db/seeds/dev/scholarships.rb seeds scholarships across the paid dev
  events, mixing completed (allocation funded) and pending ($0 allocation) so
  the dashboard shows allocated vs unallocated scholarship dollars. Only funds
  registrations with no allocations yet, so a full or partial award fits within
  the event cost (the allocation validation rejects over-allocation).
- Wire db:seed:scholarships into dev.rake (run order after payments, plus a
  standalone task).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Scale the flagship training for the dashboard demo

Make AWBW Facilitator Training a $1,500 event with a 15-registrant cohort so
the scholarship seeds have room to award 10 full/partial scholarships across
allocation-free registrations. Keep cost in sync on re-seed (find_or_create_by!
only sets it on create), and top up generated cohort registrants idempotently.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* Update dashboard request spec for renamed cont ed label

The dashboard now labels the card "Continuing education fees" (was "Cont ed
fees"); update the request-spec assertion to match.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants