From abd7d1eb4b219a533093cf1629dd9dae790ded56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20S=C3=A1nchez?= Date: Fri, 5 Jun 2026 20:04:59 -0300 Subject: [PATCH] minor fixes --- utils/statistics_server_v3.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/statistics_server_v3.py b/utils/statistics_server_v3.py index 551c148..e354603 100644 --- a/utils/statistics_server_v3.py +++ b/utils/statistics_server_v3.py @@ -181,13 +181,13 @@ def query_total_profit(pair=None, start_date=0): query = "SELECT SUM(amount) AS total_profit FROM profits_table WHERE timestamp >= ?" params = (start_date,) else: - query = """SELECT pair, SUM(amount) AS total_profit FROM profits_table WHERE timestamp >= ? AND pair = ?""" + query = """SELECT SUM(amount) AS total_profit FROM profits_table WHERE timestamp >= ? AND pair = ?""" params = (start_date, pair) with db_cursor() as cursor: cursor.execute(query, params) result = cursor.fetchone() - return result[0] if result[0] else 0 + return result[0] if result else 0 def daily_and_monthly_totals() -> tuple[float, float]: @@ -514,7 +514,7 @@ def get_averages(): with db_cursor() as cursor: cursor.execute("""SELECT COALESCE(SUM(CASE WHEN timestamp >= ? THEN amount END), 0) AS sum_30d, - COALESCE(SUM(CASE WHEN timestamp >= ? THEN amount END), 0) AS sum_7d, + COALESCE(SUM(CASE WHEN timestamp >= ? THEN amount END), 0) AS sum_7d FROM profits_table""", (time.time()-30*86400, time.time()-7*86400)) row = cursor.fetchone()