This document describes the lifecycle of a learning Session, how it selects
exercises, and how unfinished sessions can be resumed.
Exercise-specific behaviour is described in Exercises.
stateDiagram-v2
[*] --> Created
Created --> Active: beginSession
Active --> Snapshot: pause and persist
Snapshot --> Active: reconstruct and resumeSession
Active --> Ended: endSession
Ended --> [*]
Snapshot represents persisted resume data; it is not a state stored inside
the Domain Session object.
A session receives:
SessionType (wordSession or sentenceSession);SRSConfig shared by those exercises;SessionResult when resuming.Construction verifies that every exercise matches the requested session type. The session does not create exercises and does not decide which due or new exercises enter the list.
beginSession records the start time and selects the first exercise. For each
submitted answer, the session:
Interval previews are delegated to the current exercise and leave both the exercise and session result unchanged.
endSession records the end time and may be called before every exercise is
complete. Once ended, the session cannot accept another answer. An empty
exercise list produces a session that is immediately finished after starting.
SessionScheduler separates exercises into two groups:
learning and relearning exercises, ordered by their next review time;newExercise, toReview, and consolidating
exercises, considered in shuffled order.A learning exercise takes priority once its short interval is due. Otherwise, an immediately available exercise is selected. If only learning work remains, the earliest exercise is selected even when its interval has not fully elapsed.
The scheduler reads exercise state but never applies answers itself.
The Domain exposes one ExerciseResume per exercise. When the Application
pauses a session, Persistence stores these snapshots with the intermediate
SessionResult and releases the in-memory object.
To resume, Persistence reloads each exercise’s current progression, restores
its saved status and optional sentence training count, and constructs a new
Session. resumeSession then selects the next exercise without changing the
original start time.
SessionResultSessionResult stores the session type, start and end times, the number of
unique completed exercises, and answer counts grouped by exercise status. It is
used both for statistics and as the persistent identity of an unfinished
session.
The result is an aggregate only. It does not contain exercise evaluation or SRS logic.