Skip to content

Don't save ESC-aborted runs to history #53

@ptrsauer

Description

@ptrsauer

Problem

When a user presses ESC during a test, the incomplete run is saved to history.csv with the same format as a completed run. There's no way to distinguish aborted from completed tests.

This pollutes training statistics — a 4-second aborted run with 67.7% accuracy and 49.5 adjusted WPM gets averaged in alongside legitimate runs, skewing progress tracking.

Example from real history:

2026-02-16 16:02:08,peter1000,50,73.2,49.5,67.7,44,65,x:0%;i:0%;w:0%;k:0%;t:33%,Layer;entwickelt;strukturiert,85.7

This was an ESC abort after ~4 seconds (previous run finished at 16:01:43).

Current behavior

main.rs:444-463 — ESC in State::Test creates Results::from(test) and calls save_results() unconditionally (unless --no-save).

Proposed solution

Option A (simplest): Don't save to history when ESC is pressed during a test. The user explicitly chose to abort — the partial data has no training value.

Option B (more flexible): Add a status column to the CSV (completed / aborted). Filter out aborted runs in show_history() and show_stats() by default, with a --include-aborted flag to show them.

Option A is probably sufficient for most use cases. Option B preserves data but adds complexity.

Affected code

  • src/main.rs — ESC handler (line ~444-463)
  • src/history.rssave_results() (line 76-92)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions