Skip to content

Store what the learner answered in wrong exercise attempts - #898

Merged
mircealungu merged 1 commit into
masterfrom
wt/exercise-attempts
Oct 23, 2026
Merged

mircealungu merged 1 commit into
masterfrom
wt/exercise-attempts

Conversation

@mircealungu

Copy link
Copy Markdown
Member

The outcome code (WWC) says an attempt was wrong, not what was answered. To tell a word the learner keeps confusing with another meaning (har det dårligt answered as "feel sad") from one they just forget, we need the answers.

  • New table exercise_wrong_answer (exercise_id, attempt_i, answer), one row per wrong attempt. ON DELETE CASCADE from exercise, so account deletion and merge need no change (merge repoints exercise.user_word_id; the rows follow their exercise).
  • /report_exercise_outcome takes an optional wrong_answers form field: a JSON list of strings, the typed text or the option picked. Old clients send none. A malformed value is dropped, never refused, so the outcome is not lost. Blank answers skipped, max 20 per exercise, cut at 255 chars.

Migration: tools/migrations/26-10-23--add_exercise_wrong_answer.sql (new table, no rebuild). Deploy order: migration → API → web (web PR to follow).

Not run on a local MySQL (no docker on this machine); the sqlite tests do not enforce FKs, so the cascade itself is untested.

🤖 Generated with Claude Code

The outcome code ("WWC") says an attempt was wrong, not what was answered.
exercise_wrong_answer keeps the typed text (or the option picked), one row
per wrong attempt, so a word the learner keeps confusing with another
meaning can be told apart from one they just forget.

/report_exercise_outcome takes an optional wrong_answers JSON list; older
clients send none and nothing changes for them. A malformed list is dropped
rather than refused, so the outcome is never lost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

ArchLens - No architecturally relevant changes to the existing views

@mircealungu
mircealungu merged commit 4fbe1d0 into master Oct 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant