Skip to content

Add Greatest Community Need ongoing allocation#79

Merged
kcdragon merged 2 commits into
mainfrom
greatest-community-need
Jun 30, 2026
Merged

Add Greatest Community Need ongoing allocation#79
kcdragon merged 2 commits into
mainfrom
greatest-community-need

Conversation

@kcdragon

Copy link
Copy Markdown
Collaborator

Adds Greatest Community Need as a first-class ongoing giving option, modeled as Allocation::GreatestCommunityNeed — an STI subclass of Allocation::Ongoing. Every scenario automatically gets one at 0% via a before_create hook (exposed as has_one :greatest_community_need), validated to one per scenario, with a fixed label/description and defaults applied on init. It renders as a distinct, brand-tinted ongoing card (no edit/delete controls), and the controller blocks destroying it directly while still allowing it to be removed when the whole scenario is deleted. A small to_prepare initializer preloads the STI subclass so ongoing_allocations' type-scoped query includes it when eager loading is off (dev / non-CI test). Includes model and controller tests; full suite passes (233 examples).

kcdragon and others added 2 commits June 29, 2026 22:57
Introduce Allocation::GreatestCommunityNeed, an STI subclass of
Allocation::Ongoing that every scenario gets automatically at 0% via a
before_create hook (has_one :greatest_community_need). It renders as a
distinct, tinted ongoing card with a fixed label/description, is limited
to one per scenario, and cannot be edited or deleted from the UI (the
controller also blocks its destroy).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Remove the extra blank line at the end of scenario_test.rb flagged by
Layout/EmptyLinesAroundClassBody.

Guard the STI preload so it only runs where eager loading is off
(development and local test). Referencing Allocation::GreatestCommunityNeed
during initializer evaluation under CI made SimpleCov report the whole
Allocation STI tree as uncovered, dropping line coverage below the 90%
gate; eager loading already registers the subclass in production/CI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@kcdragon kcdragon merged commit 2436208 into main Jun 30, 2026
5 checks passed
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