06/03 Optimize codes, fix Schwab Account
This commit is contained in:
@@ -282,6 +282,11 @@ def sync_snapshot(schwab_account_id):
|
||||
if not sa.pfm_account_id:
|
||||
flash('Map this account to a PFM account first.', 'warning')
|
||||
return redirect(url_for('schwab.index'))
|
||||
# Always use the currently active connection — the stored connection_id on the
|
||||
# account record may reference an older connection after a reconnect.
|
||||
active_conn = SchwabConnection.query.filter_by(is_active=True).first()
|
||||
if active_conn:
|
||||
sa.connection = active_conn
|
||||
try:
|
||||
bal_updated, pos_synced = sync_account_snapshot(sa)
|
||||
flash(
|
||||
|
||||
Reference in New Issue
Block a user