Add Greatest Community Need ongoing allocation#79
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Greatest Community Need as a first-class ongoing giving option, modeled as
Allocation::GreatestCommunityNeed— an STI subclass ofAllocation::Ongoing. Every scenario automatically gets one at 0% via abefore_createhook (exposed ashas_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 smallto_prepareinitializer preloads the STI subclass soongoing_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).