Skip to content

Add scholarship decline flow with admin email and totals exclusion - #2178

Draft
maebeale wants to merge 2 commits into
mainfrom
maebeale/scholarship-decline-email
Draft

Add scholarship decline flow with admin email and totals exclusion#2178
maebeale wants to merge 2 commits into
mainfrom
maebeale/scholarship-decline-email

Conversation

@maebeale

@maebeale maebeale commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

🤖 suggested review level: 5 Inspect 🔬 new decline state that alters financial totals across dashboards, grant budgets, revenue/scholarship reports, and many display surfaces

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

  • Recipients can now say No to a scholarship agreement (with a reason) from their scholarship page, not just Agree.
  • Declining emails the admin team an FYI (via the existing Notification pipeline), records the reason, and removes the award from every total so declined money no longer inflates dashboards, grant budgets, or reports.
  • The scholarship page also now shows how much the registrant will owe after the scholarship is applied (event cost − all allocations).

How did you approach the change?

  • Decline flow: new decline_agreement action + route; native <details> disclosure reveals a required reason box next to Agree. Scholarship#decline_agreement! stamps agreement_declined_at/reason, clears any signed state, and zeroes the allocation so all allocation-based totals self-correct.
  • Admin email: new scholarship_agreement_declined_fyi Notification kind → NotificationMailer method + HTML/text views + preview, wired through NotificationMailerJob.
  • Totals exclusion (two levers): zeroed allocation covers raw-allocation totals; .not_declined added to the amount_cents/scope readers — grant budget/remaining, funding split scopes, EventDashboard, EventScholarshipFigures, EventRevenueFigures, ScholarshipsGrouping, grant decorator counts, registrant award badge.
  • Declined shown everywhere: scholarships index rows, event registration card, grant scholarships table, event recipient card, onboarding row, admin scholarship show/edit. Reusable badge helpers on ScholarshipDecorator.
  • Re-offer + guard: editing the award amount clears the decline (and re-funds the allocation); a new scholarship-decline-guard Stimulus controller warns the admin before saving that change so the decline isn't discarded silently.
  • History: no new model — the decline is captured by the denormalized status, the FYI Notification (shown in the scholarship's Communications box), and Ahoy events (linked from the edit page's audit info).

Anything else to add?

  • Migration adds agreement_declined_at + agreement_declined_reason to scholarships.
  • Open question for review: reinstating a decline currently happens only via an amount edit. Toggling "Agreement signed" without changing the amount leaves the allocation at $0. See PR discussion.

Recipients can decline a scholarship agreement with a reason from their
scholarship page. Declining emails the admin team an FYI, records the
reason, zeroes the allocation so the award drops out of every total, and
shows a Declined badge everywhere scholarships appear. Editing the award
amount re-offers it and clears the decline.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 12, 2026 16:11

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.

Editing the award amount re-offers the scholarship and discards the
recipient's recorded decline; warn the admin before that happens.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings August 12, 2026 17:01

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.

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