diff --git a/backend/app/routers/sessions.py b/backend/app/routers/sessions.py index a823102..946ebb3 100644 --- a/backend/app/routers/sessions.py +++ b/backend/app/routers/sessions.py @@ -95,9 +95,15 @@ async def start_session( child_result = await db.execute( select(Child).where(Child.id == body.child_id, Child.user_id == current_user.id) ) - if not child_result.scalar_one_or_none(): + child = child_result.scalar_one_or_none() + if not child: raise HTTPException(status_code=404, detail="Child not found") + # Reset strikes at the start of each new day + if child.strikes != 0: + child.strikes = 0 + await manager.broadcast(body.child_id, {"event": "strikes_update", "strikes": 0}) + session_date = body.session_date or date.today() # Deactivate any existing active session for this child today