Add break time feature to schedule blocks
- Admin: per-block "Break Time" checkbox + duration (min) setting; new Break Activities section (global list, same pattern as Morning Routine) - Dashboard: break timer section appears on blocks with break enabled; Start/Pause/Resume/Reset controls work independently of the main timer - TV: left column switches to amber break badge + countdown during break; center column shows configurable Break Activities list - Backend: break_time_enabled/break_time_minutes columns on schedule_blocks (auto-migrated on startup); break_activity_items table + CRUD router; break timer events (break_start/pause/resume/reset) stored as TimerEvents and broadcast via WebSocket; break_activities included in dashboard snapshot and session_update broadcast Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ from sqlalchemy.orm import selectinload
|
||||
from app.dependencies import get_db
|
||||
from app.models.child import Child
|
||||
from app.models.morning_routine import MorningRoutineItem
|
||||
from app.models.break_activity import BreakActivityItem
|
||||
from app.models.schedule import ScheduleBlock, ScheduleTemplate
|
||||
from app.models.subject import Subject # noqa: F401 — needed for selectinload chain
|
||||
from app.models.session import DailySession, TimerEvent
|
||||
@@ -86,6 +87,13 @@ async def get_dashboard(child_id: int, db: AsyncSession = Depends(get_db)):
|
||||
)
|
||||
morning_routine = [item.text for item in routine_result.scalars().all()]
|
||||
|
||||
break_result = await db.execute(
|
||||
select(BreakActivityItem)
|
||||
.where(BreakActivityItem.user_id == child.user_id)
|
||||
.order_by(BreakActivityItem.order_index, BreakActivityItem.id)
|
||||
)
|
||||
break_activities = [item.text for item in break_result.scalars().all()]
|
||||
|
||||
return DashboardSnapshot(
|
||||
session=session,
|
||||
child=child,
|
||||
@@ -96,4 +104,5 @@ async def get_dashboard(child_id: int, db: AsyncSession = Depends(get_db)):
|
||||
day_start_time=day_start_time,
|
||||
day_end_time=day_end_time,
|
||||
morning_routine=morning_routine,
|
||||
break_activities=break_activities,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user