mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-07 22:45:20 +02:00
Fix private method access
This commit is contained in:
parent
8cafbc7f83
commit
dda446c906
2 changed files with 9 additions and 3 deletions
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue