feat: Add explicit fund allocation system to goals - #192
Merged
khanirfan18 merged 4 commits intoJun 13, 2026
Conversation
👷 Deploy request for finnboard0 pending review.Visit the deploys page to approve it
|
✅ Deploy Preview for finnboard ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
Author
|
@khanirfan18 Please review. |
Owner
|
@TanCodeX resolve the conflicts.. |
Contributor
Author
|
@khanirfan18 merge conflicts resolved. |
Owner
|
@TanCodeX Has this migration been added as a Supabase migration file, or do i need to run it manually after merge? and yeah do fix the header issues too... |
Contributor
Author
@khanirfan18 This PR introduces a new ALTER TABLE public.goals
ADD COLUMN saved_amount numeric DEFAULT 0; |
…CodeX/finBoard into feature/goal-fund-allocation # Conflicts: # src/pages/Goals.jsx
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.
Summary
Closes #191
This PR replaces the previous goal progress calculation model with an envelope-style allocation system. Instead of calculating goal progress from the user's global savings balance, each goal now maintains its own allocated savings amount, allowing users to explicitly reserve funds for individual goals.
This prevents unrelated spending from causing all goals to regress and provides a more accurate representation of progress toward savings objectives.
Changes
Database Updates
File:
supabase/schema.sqlgoalstable:This field stores the amount of savings explicitly allocated to each goal.
Migration Required
To enable this feature in existing environments, run:
Important
Existing Supabase deployments must apply this migration before using the new goal allocation functionality.
Goals Page Enhancements
File:
src/pages/Goals.jsxNew Savings Metrics
Added calculations for:
totalAllocated– total funds allocated across all goals.unallocatedSavings– available savings not yet assigned to a goal.Calculation:
Updated Summary Cards
Replaced the previous single savings summary with:
This provides better visibility into both reserved and available funds.
Goal Progress Tracking
Goal progress is now based on each goal's allocated balance (
saved_amount) instead of the global savings pool.Previous Behavior
This caused all goals to move together whenever savings increased or decreased.
New Behavior
Each goal now tracks progress independently based on funds intentionally assigned to it.
Goal Fund Management
Added a new Manage Funds action to active goals.
Users can now:
Add Funds
Withdraw Funds
Validation
Added safeguards to prevent:
Validation feedback is surfaced through the existing
showModalworkflow.State & Persistence
Fund transfers now:
update()calls.Testing
Functional Verification
saved_amount.unallocatedSavingsrecalculates after every transfer.allocationGoalId.Validation Testing
Confirmed proper handling of:
Persistence Testing
Benefits