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

Fix private method access

This commit is contained in:
Zach Gollwitzer 2025-06-15 10:01:49 -04:00
parent 8cafbc7f83
commit dda446c906
2 changed files with 9 additions and 3 deletions

View file

@ -18,9 +18,8 @@ class Account::Syncer
# TODO: this is a temporary solution to speed up pages. Long term we'll throw a materialized view / pre-computed table # TODO: this is a temporary solution to speed up pages. Long term we'll throw a materialized view / pre-computed table
# in for family stats. # in for family stats.
income_statement = IncomeStatement.new(account.family) income_statement = IncomeStatement.new(account.family)
income_statement.family_stats Rails.logger.info("Warming IncomeStatement caches")
income_statement.category_stats income_statement.warm_caches!
income_statement.totals # uses default scope internally
end end
private private

View file

@ -53,6 +53,13 @@ class IncomeStatement
family_stats(interval: interval).find { |stat| stat.classification == "income" }&.median || 0 family_stats(interval: interval).find { |stat| stat.classification == "income" }&.median || 0
end end
def warm_caches!(interval: "month")
totals
family_stats(interval: interval)
category_stats(interval: interval)
nil
end
private private
ScopeTotals = Data.define(:transactions_count, :income_money, :expense_money, :missing_exchange_rates?) ScopeTotals = Data.define(:transactions_count, :income_money, :expense_money, :missing_exchange_rates?)
PeriodTotal = Data.define(:classification, :total, :currency, :missing_exchange_rates?, :category_totals) PeriodTotal = Data.define(:classification, :total, :currency, :missing_exchange_rates?, :category_totals)