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

Fix budget money formatting (#1626)
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions

This commit is contained in:
Zach Gollwitzer 2025-01-16 19:05:34 -05:00 committed by GitHub
parent 1ae4b4d612
commit ca8bdb6241
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 13 additions and 13 deletions

View file

@ -10,7 +10,7 @@ class Budget < ApplicationRecord
monetize :budgeted_spending, :expected_income, :allocated_spending,
:actual_spending, :available_to_spend, :available_to_allocate,
:estimated_spending, :estimated_income, :actual_income
:estimated_spending, :estimated_income, :actual_income, :remaining_expected_income
class << self
def for_date(date)
@ -19,12 +19,13 @@ class Budget < ApplicationRecord
def find_or_bootstrap(family, date: Date.current)
Budget.transaction do
budget = Budget.find_or_create_by(
budget = Budget.find_or_create_by!(
family: family,
start_date: date.beginning_of_month,
end_date: date.end_of_month,
currency: family.currency
)
end_date: date.end_of_month
) do |b|
b.currency = family.currency
end
budget.sync_budget_categories