mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 05:09:38 +02:00
Fix incorrect partial sync balance generation (#1223)
This commit is contained in:
parent
fa3b1e016c
commit
c3c0ab3530
1 changed files with 3 additions and 2 deletions
|
@ -14,7 +14,8 @@ class Account::Balance::Syncer
|
||||||
|
|
||||||
if daily_balances.any?
|
if daily_balances.any?
|
||||||
account.reload
|
account.reload
|
||||||
account.update! balance: daily_balances.select { |db| db.currency == account.currency }.last&.balance
|
last_balance = daily_balances.select { |db| db.currency == account.currency }.last&.balance
|
||||||
|
account.update! balance: last_balance
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue Money::ConversionError => e
|
rescue Money::ConversionError => e
|
||||||
|
@ -102,7 +103,7 @@ class Account::Balance::Syncer
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_prior_balance
|
def find_prior_balance
|
||||||
account.balances.where("date < ?", sync_start_date).order(date: :desc).first&.balance
|
account.balances.where(currency: account.currency).where("date < ?", sync_start_date).order(date: :desc).first&.balance
|
||||||
end
|
end
|
||||||
|
|
||||||
def net_entry_flows(entries, target_currency = account.currency)
|
def net_entry_flows(entries, target_currency = account.currency)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue