mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-25 08:09:38 +02:00
Multi-currency part 1 (#542)
* Add family snapshots table * Add snapshot method, clean up family expected results * Remove old sync trigger
This commit is contained in:
parent
1cdf5ea6a7
commit
c60ddaec1d
9 changed files with 169 additions and 141 deletions
|
@ -6,13 +6,13 @@ module Account::Syncable
|
|||
end
|
||||
|
||||
def sync
|
||||
update!(status: "SYNCING")
|
||||
update!(status: "syncing")
|
||||
synced_daily_balances = Account::BalanceCalculator.new(self).daily_balances
|
||||
self.balances.upsert_all(synced_daily_balances, unique_by: :index_account_balances_on_account_id_and_date)
|
||||
self.balances.where("date < ?", effective_start_date).delete_all
|
||||
update!(status: "OK")
|
||||
update!(status: "ok")
|
||||
rescue => e
|
||||
update!(status: "ERROR")
|
||||
update!(status: "error")
|
||||
Rails.logger.error("Failed to sync account #{id}: #{e.message}")
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue