1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-09 15:35:22 +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:
Cameron Roudebush 2025-05-14 20:58:50 -04:00
parent 1137f1f57b
commit d5acd4935a
4 changed files with 7 additions and 9 deletions

View file

@ -26,7 +26,7 @@ class SimpleFinController < ApplicationController
def sync
@simple_fin_item = Current.family.simple_fin_items.find(params[:id])
unless @simple_fin_item.syncing?
@simple_fin_item.sync_later
@simple_fin_item.sync
end
respond_to do |format|

View file

@ -69,9 +69,6 @@ class SimpleFinAccount < ApplicationRecord
# Ensure accountable_attributes has the ID for updates
# 'account' here refers to self.account (the associated Account instance)
accountable_attributes = { id: self.account.accountable_id }
puts "SFA #{sf_account_data}"
self.update!(
current_balance: sf_account_data["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"],
status: sf_account_data["org"]["institution_errors"].empty? ? :good : :requires_update
institution_errors = sf_account_data["org"]["institution_errors"]
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

View file

@ -115,7 +115,7 @@ class SimpleFinItem < ApplicationRecord
# These could be marked as closed, archived, etc. For example:
# 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}")
# rescue Provider::SimpleFin::AuthenticationError => e # Catch specific auth errors if your provider defines them.

View file

@ -80,7 +80,7 @@
<%= yield :sidebar %>
<% else %>
<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" %>
</div>