mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-10 07:55:21 +02:00
fix(render): Adjust turbo to not permanent the accounts as they now could show errors
- Also fixing some update status being wrong
This commit is contained in:
parent
1137f1f57b
commit
d5acd4935a
4 changed files with 7 additions and 9 deletions
|
@ -26,7 +26,7 @@ class SimpleFinController < ApplicationController
|
||||||
def sync
|
def sync
|
||||||
@simple_fin_item = Current.family.simple_fin_items.find(params[:id])
|
@simple_fin_item = Current.family.simple_fin_items.find(params[:id])
|
||||||
unless @simple_fin_item.syncing?
|
unless @simple_fin_item.syncing?
|
||||||
@simple_fin_item.sync_later
|
@simple_fin_item.sync
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
|
@ -69,9 +69,6 @@ class SimpleFinAccount < ApplicationRecord
|
||||||
# Ensure accountable_attributes has the ID for updates
|
# Ensure accountable_attributes has the ID for updates
|
||||||
# 'account' here refers to self.account (the associated Account instance)
|
# 'account' here refers to self.account (the associated Account instance)
|
||||||
accountable_attributes = { id: self.account.accountable_id }
|
accountable_attributes = { id: self.account.accountable_id }
|
||||||
|
|
||||||
puts "SFA #{sf_account_data}"
|
|
||||||
|
|
||||||
self.update!(
|
self.update!(
|
||||||
current_balance: sf_account_data["balance"].to_d,
|
current_balance: sf_account_data["balance"].to_d,
|
||||||
available_balance: sf_account_data["available-balance"]&.to_d,
|
available_balance: sf_account_data["available-balance"]&.to_d,
|
||||||
|
@ -85,10 +82,11 @@ class SimpleFinAccount < ApplicationRecord
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
self.simple_fin_item.update!(
|
institution_errors = sf_account_data["org"]["institution_errors"]
|
||||||
institution_errors: sf_account_data["org"]["institution_errors"],
|
|
||||||
status: sf_account_data["org"]["institution_errors"].empty? ? :good : :requires_update
|
|
||||||
|
|
||||||
|
self.simple_fin_item.update!(
|
||||||
|
institution_errors: institution_errors.empty? ? []: institution_errors,
|
||||||
|
status: institution_errors.empty? ? :good : :requires_update
|
||||||
)
|
)
|
||||||
|
|
||||||
# Sync transactions if present in the data
|
# Sync transactions if present in the data
|
||||||
|
|
|
@ -115,7 +115,7 @@ class SimpleFinItem < ApplicationRecord
|
||||||
# These could be marked as closed, archived, etc. For example:
|
# These could be marked as closed, archived, etc. For example:
|
||||||
# simple_fin_accounts.where.not(external_id: current_provider_external_ids).find_each(&:archive!)
|
# simple_fin_accounts.where.not(external_id: current_provider_external_ids).find_each(&:archive!)
|
||||||
|
|
||||||
update!(status: :good) # Mark connection as successfully synced.
|
# update!(status: :good) # Mark connection as successfully synced.
|
||||||
Rails.logger.info("SimpleFinConnection: Sync completed for connection ID #{id}")
|
Rails.logger.info("SimpleFinConnection: Sync completed for connection ID #{id}")
|
||||||
|
|
||||||
# rescue Provider::SimpleFin::AuthenticationError => e # Catch specific auth errors if your provider defines them.
|
# rescue Provider::SimpleFin::AuthenticationError => e # Catch specific auth errors if your provider defines them.
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
<%= yield :sidebar %>
|
<%= yield :sidebar %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="h-full flex flex-col">
|
<div class="h-full flex flex-col">
|
||||||
<div class="overflow-y-auto grow" id="account-sidebar-tabs" data-turbo-permanent>
|
<div class="overflow-y-auto grow" id="account-sidebar-tabs">
|
||||||
<%= render "accounts/account_sidebar_tabs", family: Current.family, active_account_group_tab: params[:account_group_tab] || "assets" %>
|
<%= render "accounts/account_sidebar_tabs", family: Current.family, active_account_group_tab: params[:account_group_tab] || "assets" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue