1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-26 00:29:40 +02:00
Maybe/app/models/account_balance.rb

13 lines
333 B
Ruby
Raw Normal View History

class AccountBalance < ApplicationRecord
belongs_to :account
scope :in_period, ->(period) { period.date_range.nil? ? all : where(date: period.date_range) }
def self.to_series(account, period = Period.all)
MoneySeries.new(
in_period(period).order(:date),
{ trend_type: account.classification }
)
end
end