Skip to content

Finalize learning algorithm - #4

Merged
NeonD00m merged 13 commits into
mainfrom
finalize-learning-algorithm
Aug 25, 2026
Merged

NeonD00m merged 13 commits into
mainfrom
finalize-learning-algorithm

Conversation

@NeonD00m

Copy link
Copy Markdown
Owner

three new study modes: test (renamed old learn mode), cram/study, and the new learn mode with FSRS integrated
-> revamped stats dashboard accordingly to abandon old SM-2 and bring in FSRS stuff

also upgraded sqlite storage systems to handle versions and migrations better, and added ExportAll and ImportAll commands to import and export all decks in case of a storage update problem where one might reinstall Quizzy or just to transfer in between devices or something

@NeonD00m NeonD00m added the enhancement New feature or request label Aug 15, 2026
@NeonD00m NeonD00m self-assigned this Aug 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There are several confirmed correctness issues in the new dashboard/stats persistence paths (FSRS timestamping, dashboard query counting/filtering, and INTEGER/REAL score handling) that can produce wrong scheduling or misleading/invalid UI behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR finalizes the app’s learning/study workflow by replacing SM-2 with an FSRS-based scheduler, introducing new study modes (Learn/Test/Cram/Study), revamping stats output accordingly, and adding safer SQLite schema versioning plus bulk import/export commands to support migrations and device transfers.

Changes:

  • Introduces an FSRS engine + persistence path for learn sessions, plus a new interactive “Learn Dashboard”.
  • Splits prior “learn” behavior into dedicated Learn (FSRS) and Test (non-FSRS) modes and adds “Cram/Study” flashcard-style mode.
  • Adds versioned SQLite migrations and new ImportAll/ExportAll commands to improve storage resilience and transfer workflows.
File summaries
File Description
src/ui/stats.rs Updates stats UI to display FSRS-oriented labels/fields (stability/difficulty/due).
src/ui/learn.rs Adds Learn dashboard, implements FSRS learn session loop, and renames old learn flow into test mode.
src/ui/input.rs Generalizes input handling with key_input and restores enter_input as a wrapper.
src/ui/import.rs Updates deck creation call signature to new storage API.
src/ui/general.rs Expands deck selection behavior and adds ImportAll/Export/ExportAll commands.
src/ui/cards.rs Makes Cards mode optionally interactive via storage + adds cram mode implementation.
src/migrations/002_sm2_to_fsrs.sql Rebuilds card_stats schema from SM-2 columns to FSRS columns.
src/migrations/003_drop_source_hash.sql Rebuilds decks table to drop unused source_hash.
src/migrations/004_add_fsrs_lapses_and_state.sql Adds FSRS lapses/state tracking fields.
src/mcp/server.rs Updates MCP server output + storage calls to match FSRS/storage API changes.
src/main.rs Adds new CLI commands/modes and wires them into updated UI/core flows.
src/core/storage.rs Adds FSRSStats, dashboard queries, new commit APIs, and migration runner integration.
src/core/mod.rs Exposes new core modules (fsrs, migrations).
src/core/migrations.rs Introduces schema migration runner + embedded migration list.
src/core/learn.rs Replaces legacy session delta format with JSON SessionPayload + unified commit retry.
src/core/fsrs.rs Adds FSRS scheduling engine implementation + tests.
src/core/deck.rs Enhances deck file parsing/writing (JSON includes deck name; names inferred from filename).
my_todo.json Updates local TODO metadata format (tags/files) and completion statuses.
benches/mc_bench.rs Adjusts bench code to new read_deck_from_file signature.
Review details

Suppressed comments (2)

src/core/storage.rs:711

  • get_weakest_cards uses COALESCE(s.learning_score, 0.0) but then reads the column into an i64. If learning_score ever becomes REAL (or if SQLite returns a REAL due to the literal), this can fail or coerce unexpectedly. Since the schema is INTEGER, coalesce with 0 (integer).
        let mut stmt = self.conn.prepare(
            "SELECT c.id, c.term, c.definition, COALESCE(s.learning_score, 0.0) as score
                FROM cards c
                LEFT JOIN card_stats s ON c.id = s.card_id
                WHERE c.deck_id = ?1

src/core/storage.rs:815

  • The dashboard query filters out decks with due_cards == 0, which can make learn_dashboard report "No decks found" even when decks exist (just with nothing due/new). The dashboard should likely list all decks and show 0s.
            .filter(|res| {
                if let Ok(i) = res {
                    i.due_cards > 0
                } else {
  • Files reviewed: 19/19 changed files
  • Comments generated: 6
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/ui/learn.rs
Comment thread src/ui/learn.rs
Comment thread src/core/storage.rs Outdated
Comment thread src/core/storage.rs
Comment thread src/core/storage.rs
Comment thread src/ui/general.rs Outdated
@NeonD00m
NeonD00m merged commit a095180 into main Aug 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants