Add subject options and redesign TV dashboard layout
Subject options: - New subject_options table (auto-created on startup) - SubjectOut now includes options list; all eager-loading chains updated - Admin: Options panel per subject with add, inline edit, and delete - WS broadcast and dashboard API include options in block subject data TV dashboard: - Three equal columns: Timer | Activities | Schedule - Activities column shows current subject's options in large readable text - Activities area has subject-colored border and tinted background - Subject name and label displayed correctly using embedded subject data 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.schedule import ScheduleBlock, ScheduleTemplate
|
||||
from app.models.subject import Subject # noqa: F401 — needed for selectinload chain
|
||||
from app.models.session import DailySession, TimerEvent
|
||||
from app.schemas.session import DashboardSnapshot
|
||||
|
||||
@@ -48,6 +49,7 @@ async def get_dashboard(child_id: int, db: AsyncSession = Depends(get_db)):
|
||||
blocks_result = await db.execute(
|
||||
select(ScheduleBlock)
|
||||
.where(ScheduleBlock.template_id == session.template_id)
|
||||
.options(selectinload(ScheduleBlock.subject).selectinload(Subject.options))
|
||||
.order_by(ScheduleBlock.order_index)
|
||||
)
|
||||
blocks = blocks_result.scalars().all()
|
||||
|
||||
Reference in New Issue
Block a user