mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 20:14:08 +00:00
Add post-sync UI stream updates (#1482)
* Add post-sync UI stream updates * Fix stream channel id
This commit is contained in:
@@ -99,6 +99,10 @@ class Account < ApplicationRecord
|
||||
Holding::Syncer.new(self, start_date: start_date).run
|
||||
end
|
||||
|
||||
def post_sync
|
||||
accountable.post_sync
|
||||
end
|
||||
|
||||
def original_balance
|
||||
balance_amount = balances.chronological.first&.balance || balance
|
||||
Money.new(balance_amount, currency)
|
||||
|
||||
@@ -46,6 +46,6 @@ class Account::Balance::Syncer
|
||||
end
|
||||
|
||||
def is_partial_sync?
|
||||
sync_start_date == provided_start_date && sync_start_date < Date.current
|
||||
sync_start_date == provided_start_date
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,4 +33,15 @@ module Accountable
|
||||
rescue Money::ConversionError
|
||||
TimeSeries.new([])
|
||||
end
|
||||
|
||||
def post_sync
|
||||
broadcast_remove_to(account, target: "syncing-notification")
|
||||
|
||||
broadcast_replace_to(
|
||||
account,
|
||||
target: "chart_account_#{account.id}",
|
||||
partial: "accounts/show/chart",
|
||||
locals: { account: account }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -54,4 +54,15 @@ class Investment < ApplicationRecord
|
||||
def icon
|
||||
"line-chart"
|
||||
end
|
||||
|
||||
def post_sync
|
||||
broadcast_remove_to(account, target: "syncing-notification")
|
||||
|
||||
broadcast_replace_to(
|
||||
account,
|
||||
target: "chart_account_#{account.id}",
|
||||
partial: account.plaid_account_id.present? ? "investments/chart" : "accounts/show/chart",
|
||||
locals: { account: account }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user