From 541cb262ee5783eedf2b154c148c28ec89845da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elisi=C3=A1rio=20Couto?= Date: Tue, 9 Sep 2025 15:47:37 +0100 Subject: [PATCH] fix: use account status for balance records instead of hardcoded 'active' - Modified sync service to pass account status to balance persistence - Updated database service to use account_status from balance data - Fixed 8 balance records that had incorrect 'active' status - All balance records now have consistent 'READY' status matching accounts - Future balance records will inherit correct status from account data --- leggend/services/database_service.py | 2 +- leggend/services/sync_service.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/leggend/services/database_service.py b/leggend/services/database_service.py index 42c03f4..00af994 100644 --- a/leggend/services/database_service.py +++ b/leggend/services/database_service.py @@ -446,7 +446,7 @@ class DatabaseService: ( account_id, balance_data.get("institution_id", "unknown"), - "active", + balance_data.get("account_status"), balance_data.get("iban", "N/A"), float(balance_amount["amount"]), balance_amount["currency"], diff --git a/leggend/services/sync_service.py b/leggend/services/sync_service.py index 0567f38..9b87a6d 100644 --- a/leggend/services/sync_service.py +++ b/leggend/services/sync_service.py @@ -68,6 +68,9 @@ class SyncService: account_details.get("institution_id") ) balances_with_account_info["iban"] = account_details.get("iban") + balances_with_account_info["account_status"] = ( + account_details.get("status") + ) await self.database.persist_balance( account_id, balances_with_account_info )