fix(achievements): Graduate achievements only unlock when all kanji for the specific JLPT level are mastered#7152
Draft
fix(achievements): Graduate achievements only unlock when all kanji for the specific JLPT level are mastered#7152
Conversation
The checkContentMastery function was ignoring jlptLevel for kanji, checking ALL kanji in characterMastery instead of only those belonging to the specific JLPT level. This caused N4-N1 Graduate achievements to unlock when only N5 kanji had been practiced. - Add kanjiSets.ts with static character Sets per JLPT level (N5-N1) - Fix checkContentMastery to filter kanji by jlptLevel and require ALL kanji from that level to have been practiced with >=80% accuracy - Improve progress calculation in useAchievementProgress.ts to show actual kanji mastery count (X/Y) for Graduate achievements - Add kanjiGraduate.test.ts with 8 regression tests Co-authored-by: tentoumushii <169354375+tentoumushii@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix graduate achievements awarded incorrectly
fix(achievements): Graduate achievements only unlock when all kanji for the specific JLPT level are mastered
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
checkContentMasteryforcontentType === 'kanji'ignoredjlptLevelentirely — it checked whatever kanji happened to be incharacterMastery, so practicing a handful of N5 kanji with ≥80% accuracy trivially satisfied N4–N1 Graduate checks as well.Root cause
Changes
store/kanjiSets.ts(new) — StaticSet<string>per JLPT level extracted frompublic/data-kanji/*.json(N5: 80, N4: 167, N3: 370, N2: 374, N1: 1504 chars), plus aKANJI_BY_JLPT_LEVELlookup map. Same pattern as the existingBASIC_HIRAGANA/BASIC_KATAKANAsets.checkContentMastery— Kanji branch now requiresjlptLevel, scopesrelevantEntriesto only that level's set, and guardsrelevantEntries.length < kanjiSet.sizeso all kanji in the level must have been practiced before the achievement can unlock:useAchievementProgress.ts— Progress for kanji Graduate achievements now displaysmasteredCount / kanjiSet.size(count of level-specific kanji at ≥80% accuracy) instead of a static 0%.__tests__/kanjiGraduate.test.ts(new) — Regression tests covering: correct set sizes, practicing only N5 does not unlock N4–N1, partial N5 practice does not unlock N5, below-threshold accuracy does not unlock, and each level checks its own set.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.