1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-04 21:15:19 +02:00

fix: subcategories are not properly handled for budget allocations (#1844)
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions

* fix: `allocated_spending` logic

* fix: subcategories exceeding parent limit

* refactor: budget allocations and max allocation logic

* feat: add stream for budget category form validation

* feat: update uncategorized value via stream, refactor confirm button with stream

* fix: ensure live updates for parent & sibling budgets in Turbo Stream

* fix: lint issues
This commit is contained in:
Paul Imoke 2025-02-11 14:28:06 +00:00 committed by GitHub
parent 077694bbde
commit fb6c6fa6bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 60 additions and 13 deletions

View file

@ -133,10 +133,10 @@ class Budget < ApplicationRecord
end
# =============================================================================
# Budget allocations: How much user has budgeted for all categories combined
# Budget allocations: How much user has budgeted for all parent categories combined
# =============================================================================
def allocated_spending
budget_categories.sum(:budgeted_spending)
budget_categories.reject { |bc| bc.subcategory? }.sum(&:budgeted_spending)
end
def allocated_percent