Add tests
This commit is contained in:
@@ -164,7 +164,6 @@ def calculate_progress_badges(readings):
|
||||
sorted_readings = sorted(readings, key=lambda r: r.timestamp.date())
|
||||
streak_count = 1
|
||||
daily_streak = True
|
||||
monthly_tracker = defaultdict(int)
|
||||
|
||||
# Start with the first reading
|
||||
previous_date = sorted_readings[0].timestamp.date()
|
||||
@@ -178,9 +177,6 @@ def calculate_progress_badges(readings):
|
||||
elif (current_date - previous_date).days > 1:
|
||||
daily_streak = False
|
||||
|
||||
# Track monthly activity
|
||||
monthly_tracker[current_date.strftime('%Y-%m')] += 1
|
||||
|
||||
previous_date = current_date
|
||||
|
||||
# Add streak badges
|
||||
@@ -192,11 +188,6 @@ def calculate_progress_badges(readings):
|
||||
if daily_streak and streak_count >= 30 and previous_date == now:
|
||||
badges.append("Monthly Streak")
|
||||
|
||||
# Add calendar month streak badges
|
||||
for month, count in monthly_tracker.items():
|
||||
if count >= 30:
|
||||
badges.append(f"Full Month of Logging: {month}")
|
||||
|
||||
if all(5 <= r.timestamp.hour < 12 for r in sorted_readings[-7:]):
|
||||
badges.append("Morning Riser: Logged Readings Every Morning for a Week")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user