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 <[email protected]>
This commit is contained in:
derekcandClaude Sonnet 4.6 committed 2026-02-28 16:22:17 -08:00
1 parent 3670bc63e7
commit 7346159745
5 files changed
+17 -5

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@ class ScheduleTemplate(TimestampMixin, Base):
user: Mapped["User"] = relationship("User", back_populates="schedule_templates") # noqa: F821
child: Mapped["Child | None"] = relationship("Child") # noqa: F821
blocks: Mapped[list["ScheduleBlock"]] = relationship(
"ScheduleBlock", back_populates="template", cascade="all, delete-orphan", order_by="ScheduleBlock.order_index"
"ScheduleBlock", back_populates="template", cascade="all, delete-orphan", order_by="ScheduleBlock.time_start"
)
daily_sessions: Mapped[list["DailySession"]] = relationship( # noqa: F821
"DailySession", back_populates="template"