From dff63f325f98818efefaaf8723b1fc40be6d068f Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Tue, 28 Oct 2025 14:56:30 -0400 Subject: [PATCH] [scrobbles] Fix calorie aggregation bug --- vrobbler/apps/scrobbles/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vrobbler/apps/scrobbles/utils.py b/vrobbler/apps/scrobbles/utils.py index fd9a83f..386e4ac 100644 --- a/vrobbler/apps/scrobbles/utils.py +++ b/vrobbler/apps/scrobbles/utils.py @@ -394,7 +394,10 @@ def get_daily_calories_for_user_by_day(user_id: int, date: date| str) -> int: if isinstance(date, str): date = pendulum.parse(date) - qs = base_scrobble_qs(user_id).filter(day=date) + try: + qs = base_scrobble_qs(user_id).filter(day=date) + except AttibuteError as e: + logger.warning(f"Can't generate calorie total: {e}") agg = qs.aggregate(total_calories=models.Sum("calories_int")) return agg["total_calories"] or 0