1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-22 14:49:38 +02:00

Improve chart performance and gapfilling (#2306)
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-05-25 20:40:18 -04:00 committed by GitHub
parent e1b81ef879
commit 6e202bd7ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 382 additions and 196 deletions

View file

@ -3,12 +3,17 @@ class AccountableSparklinesController < ApplicationController
@accountable = Accountable.from_type(params[:accountable_type]&.classify)
@series = Rails.cache.fetch(cache_key) do
family.accounts.active
.where(accountable_type: @accountable.name)
.balance_series(
currency: family.currency,
favorable_direction: @accountable.favorable_direction
)
account_ids = family.accounts.active.where(accountable_type: @accountable.name).pluck(:id)
builder = Balance::ChartSeriesBuilder.new(
account_ids: account_ids,
currency: family.currency,
period: Period.last_30_days,
favorable_direction: @accountable.favorable_direction,
interval: "1 day"
)
builder.balance_series
end
render layout: false