Study.Card resource with SRS state #25

Open
opened 2026-09-26 13:58:36 +00:00 by belvedere · 0 comments
Collaborator

Objective: The unit of study: one concept, in one direction, for one deck, with its schedule.

Files:

  • Create: lib/first_thousand_words/study/card.ex

Steps:

  1. Attributes: direction (:recognise | :produce | :listen, default :recognise),
    state (:new | :learning | :review | :suspended), interval_days, ease,
    reps, lapses, due_at, last_reviewed_at, suspended_at.
  2. belongs_to :deck, belongs_to :concept.
  3. Unique on (deck_id, concept_id, direction), so deck regeneration is safe.
  4. Index on (deck_id, state, due_at) — this is the hot query.

Verify: in IEx, build a card, apply Scheduler.review/3, confirm fields advance.

Note: keep scheduling state on the card and the history in Study.Review. Storing only a
counter loses the ability to recompute or to change algorithms later.

**Objective:** The unit of study: one concept, in one direction, for one deck, with its schedule. **Files:** - Create: `lib/first_thousand_words/study/card.ex` **Steps:** 1. Attributes: `direction` (`:recognise | :produce | :listen`, default `:recognise`), `state` (`:new | :learning | :review | :suspended`), `interval_days`, `ease`, `reps`, `lapses`, `due_at`, `last_reviewed_at`, `suspended_at`. 2. `belongs_to :deck`, `belongs_to :concept`. 3. Unique on `(deck_id, concept_id, direction)`, so deck regeneration is safe. 4. Index on `(deck_id, state, due_at)` — this is the hot query. **Verify:** in IEx, build a card, apply `Scheduler.review/3`, confirm fields advance. **Note:** keep scheduling *state* on the card and the *history* in `Study.Review`. Storing only a counter loses the ability to recompute or to change algorithms later.
Sign in to join this conversation.
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nickkeers/first-thousand-words#25
No description provided.