Skip to content

Scheduling logic and shared session write helpers - #522

Draft
jhodapp wants to merge 1 commit into
mainfrom
feat/scheduling-logic
Draft

jhodapp wants to merge 1 commit into
mainfrom
feat/scheduling-logic

Conversation

@jhodapp

@jhodapp jhodapp commented Nov 2, 2026

Copy link
Copy Markdown
Member

Description

First of five PRs for the new stepped "New session" dialog (schedule + reschedule). This one adds the pure scheduling logic and copy the dialog will use, and pulls out three helpers so the dialog reuses existing code. No UI changes; nothing renders the new modules yet.

Changes

  • src/lib/scheduling.ts: busy sessions on a day, slot overlap (touching edges are free), next free start, free half-hour slots within working hours (default 9–17), a person's usual slot (series start, else a weekday+time seen at least twice), suggested start times (usual → coach's frequent starts → round hours, free only, max 5), and step order for schedule/move modes.
  • src/lib/scheduling-copy.ts: dialog labels (Who sub-lines, busy/overlap lines, repeat and submit labels, meeting-link line). Toasts scheduledMessage / rescheduledMessage go in session-change-message.ts.
  • src/lib/people.ts: peopleFor, activityByPerson, menuPerson, initialsOf move out of the Join session menu hook unchanged, so the dialog can share them.
  • Shared helpers: sessionEndIn and toSessionDate in session-window.ts (replaces 2 inline copies); sessionWriteFailure in lib/api/coaching-session-errors.ts (the session form's error-to-toast chain, same messages); duration field rules (clampDuration, 15–180 in steps of 5, chips 30/45/50/60).

Testing Strategy

  • 69 new unit tests written as the spec before the code; all 2557 tests pass, tsc and lint clean.
  • Behavior preserved: existing form, reschedule-series and Join session tests pass unedited.

Concerns

  • The working-hours default is a constant until a setting exists (none in the backend today).

@jhodapp jhodapp changed the title feat(scheduling): scheduling logic and shared session write helpers Scheduling logic and shared session write helpers Nov 2, 2026
@jhodapp jhodapp self-assigned this Nov 2, 2026
@jhodapp jhodapp added the enhancement Improves existing functionality or feature label Nov 2, 2026
@jhodapp jhodapp added this to the 1.0.0-beta4 milestone Nov 2, 2026
@jhodapp jhodapp moved this to 🏗 In progress in Refactor Coaching Platform Nov 2, 2026
@jhodapp jhodapp added the feature work Specifically implementing a new feature label Nov 3, 2026
@jhodapp jhodapp moved this from 🏗 In progress to Review in Refactor Coaching Platform Nov 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improves existing functionality or feature feature work Specifically implementing a new feature

Projects

Status: Review

Development

Successfully merging this pull request may close these issues.

1 participant