AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(backend): Fix get balance error on user with null running balance (#9365)
Zamil Majdyf67060fd8fc0
diff --git a/autogpt_platform/backend/backend/data/credit.py b/autogpt_platform/backend/backend/data/credit.pyindex b4953eed29..5feb5f9292 100644--- a/autogpt_platform/backend/backend/data/credit.py+++ b/autogpt_platform/backend/backend/data/credit.py@@ -132,12 +132,14 @@ class UserCreditBase(ABC):},)transaction_balance = (- transactions[0].get("_sum", {}).get("amount", 0) + snapshot_balance+ int(transactions[0].get("_sum", {}).get("amount", 0) + snapshot_balance)if transactionselse snapshot_balance)transaction_time = (- transactions[0].get("_max", {}).get("createdAt", datetime_min)+ datetime.fromisoformat(+ str(transactions[0].get("_max", {}).get("createdAt", datetime_min))+ )if transactionselse snapshot_time)