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