# Forma — Workout Schedule & Ordering Logic ## Overview Forma should let users choose how their workout split is assigned to upcoming training days. There are three scheduling modes: 1. **Fixed Schedule Slots** 2. **Oldest Training First** 3. **Keep Workout Order, Adapt to Training History** The user's selected mode determines how upcoming workouts are assigned to their training days. **Default mode: Keep Workout Order, Adapt to Training History.** --- ## 1. Fixed Schedule Slots This is the current scheduling behavior. The user chooses their training days and assigns their workout split to those days. Example: - Training days: Monday, Tuesday, Thursday, Friday - Split: Upper A, Lower A, Upper B, Lower B ```text Monday → Upper A Tuesday → Lower A Thursday → Upper B Friday → Lower B ``` The workout order is tied to the weekly schedule. Completing or skipping a workout does **not** change the assignment. If Monday's Upper A is missed: ```text Monday → Upper A (Missed) Tuesday → Lower A Thursday → Upper B Friday → Lower B ``` ### Key rule **Calendar date → schedule slot → workout.** Completion status is independent from scheduling. --- ## 2. Oldest Training First In this mode, upcoming workouts are ordered according to **how long it has been since each workout was last completed**. Example: Training days: ```text Monday, Tuesday, Thursday, Friday ``` Workout split: ```text Upper A Lower A Upper B Lower B ``` Suppose today is Tuesday and the last completion for each workout was: ```text Upper A → 4 days ago Lower A → 1 day ago Upper B → 8 days ago Lower B → 2 days ago ``` Oldest to newest: ```text Upper B → 8 days Upper A → 4 days Lower B → 2 days Lower A → 1 day ``` Therefore: ```text Today · Tuesday → Upper B Thursday → Upper A Friday → Lower B Monday → Lower A ``` After a workout is completed, its last-completed timestamp is updated. ### Key rule **Last-completed date → priority → next available training slot.** If a workout has never been completed, treat it as older than workouts with a recorded completion history. If several have never been completed, preserve their original split order as the tie-breaker. --- ## 3. Keep Workout Order, Adapt to Training History This should be the **default mode**. This mode preserves the user's workout split order, but starts the upcoming sequence based on the workout the user most recently completed. The idea is: > **Keep the workout order, but don't force the user to perform the workout that was originally assigned to the calendar slot.** Example: Original schedule: ```text Monday → Upper A Tuesday → Lower A Thursday → Upper B Friday → Lower B ``` Suppose that on Monday the user actually completes **Lower A** instead of Upper A. Forma should treat Lower A as the user's latest completed workout and continue the split from there. The upcoming schedule becomes: ```text Monday → Lower A Tuesday → Upper B Thursday → Lower B Friday → Upper A ``` The sequence continues cyclically: ```text Upper A → Lower A → Upper B → Lower B → Upper A → ... ``` Since Lower A was just completed, the next workout in the sequence is Upper B. ### Key rule **Most recently completed workout → next workout in split order → next available training slot.** This mode does **not** reorder workouts based on which one was completed longest ago. It preserves the defined split order and uses the most recently completed workout as the point from which to continue. --- ## Comparison Using: ```text Training days: Monday, Tuesday, Thursday, Friday Split: Upper A → Lower A → Upper B → Lower B ``` | Mode | What determines the next workout? | |---|---| | Fixed Schedule Slots | The calendar slot | | Oldest Training First | The workout with the oldest last-completion date | | Keep Workout Order, Adapt to Training History | The workout immediately following the most recently completed workout in the split | --- ## Scheduling vs. Completion Status Regardless of the selected mode, keep **schedule** and **completion status** separate. A date can be: - **Rest day** — no workout scheduled - **Scheduled** — workout is planned but not completed - **Completed** — scheduled workout was completed - **Missed** — workout was scheduled, but the day passed without completion A missed workout should never automatically become the next day's workout unless the selected scheduling mode causes that workout to be selected. The system should never use a generic "next incomplete workout" rule. --- ## Important behavior ### Completing a workout Completing a workout updates its last-completed timestamp. It must not cause another workout to appear on the same calendar date. The next workout is assigned to the **next available training day**. ### Rest days A day outside the user's selected training days is always a rest day. It must not be confused with a missed workout. ### Week boundaries The split is a continuous sequence rather than resetting every Monday: ```text Upper A → Lower A → Upper B → Lower B → Upper A → Lower A → Upper B → Lower B → ... ``` --- ## Edge cases ### No completion history For a new user, use the original split order to establish the initial sequence. ### Multiple workouts completed on the same day Use the completion timestamp to determine which workout was completed most recently. ### Workout completed outside its scheduled day The completion should still update that workout's last-completed timestamp. - In mode 2, this changes its recency priority. - In mode 3, this can change where the sequence continues. ### User changes scheduling mode Changing the mode should affect future workout assignments. Historical workout records and completion history must remain intact. ### User changes training days Prefer applying the new training-day configuration from a new effective date rather than rewriting historical schedule data. --- ## Definition of Done - Users can choose between the three scheduling modes. - **Keep Workout Order, Adapt to Training History** is the default. - Fixed Schedule Slots preserves the original date → workout relationship. - Oldest Training First prioritizes workouts by oldest last-completion date. - Keep Workout Order, Adapt to Training History continues the split from the most recently completed workout. - Completing a workout never creates another workout on the same date. - Rest days and missed workouts remain distinct. - The split remains cyclic across weeks. - Historical records are preserved when scheduling logic changes. - The scheduling mode can be changed from the user's profile/settings.