Sort schedule blocks by start time instead of order_index
Backend queries and model relationship now order by time_start. Frontend also sorts blocks client-side for reliability across all views. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -50,7 +50,7 @@ async def get_dashboard(child_id: int, db: AsyncSession = Depends(get_db)):
|
||||
select(ScheduleBlock)
|
||||
.where(ScheduleBlock.template_id == session.template_id)
|
||||
.options(selectinload(ScheduleBlock.subject).selectinload(Subject.options))
|
||||
.order_by(ScheduleBlock.order_index)
|
||||
.order_by(ScheduleBlock.time_start)
|
||||
)
|
||||
blocks = blocks_result.scalars().all()
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ async def _broadcast_session(db: AsyncSession, session: DailySession) -> None:
|
||||
select(ScheduleBlock)
|
||||
.where(ScheduleBlock.template_id == session.template_id)
|
||||
.options(selectinload(ScheduleBlock.subject).selectinload(Subject.options))
|
||||
.order_by(ScheduleBlock.order_index)
|
||||
.order_by(ScheduleBlock.time_start)
|
||||
)
|
||||
blocks = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user