Skip to content

Commit 3c3f2f3

Browse files
committed
fix: Scope challenge query to today's date
1 parent 9c6a988 commit 3c3f2f3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

website/views/organization.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,8 +2402,11 @@ def add_sizzle_checkIN(request):
24022402
next_challenge_at = last_checkin_for_timer.created + timedelta(hours=CHALLENGE_RESET_HOURS)
24032403
else:
24042404
# If no check-in, check if there's a next_challenge_at set
2405+
# Scope to today's challenge to avoid returning challenges from previous days
2406+
today = now().date()
24052407
current_challenge = UserDailyChallenge.objects.filter(
24062408
user=request.user,
2409+
challenge_date=today,
24072410
status="assigned",
24082411
).first()
24092412
if current_challenge and current_challenge.next_challenge_at:

0 commit comments

Comments
 (0)