Commit f1dab6e
fix(dashboard): humanize achievement-name fallback when string resource is missing
QC sweep caught the Latest Achievement card showing raw resource keys to users: 'achievement_sessions_total_1_title' instead of 'Sessions Total 1'. The catalog auto-generates ~200 achievement ids in :stats-api/AchievementCatalog and references string resources by name (e.g. 'achievement__title'), but the localized titles are not yet authored. resolveStringResource used to leak the raw key as the visible label.
Smallest improvement that helps users: when getIdentifier returns 0, strip the 'achievement_' prefix and '_title' / '_desc' / '_description' suffix, then title-case the remaining tokens. Users now see 'Sessions Total 1' / 'Total Distance 5000' / 'Active Days 7' instead of the resource key. Proper localized titles remain a separate follow-up.
Tests: 10 cases covering prefix/suffix stripping, single-word ids, consecutive underscores, suffix-in-the-middle, empty input, and the degenerate 'achievement_title' case. Verified on emulator after triggering an end-of-session AchievementWorker: card text changed from 'achievement_sessions_total_1_title' to 'Sessions Total 1'.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 641dfad commit f1dab6e
2 files changed
Lines changed: 88 additions & 1 deletion
File tree
- dashboard/src
- main/java/com/adsamcik/tracker/dashboard/ui/compose/cards
- test/java/com/adsamcik/tracker/dashboard/ui/compose/cards
Lines changed: 25 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
270 | 271 | | |
271 | 272 | | |
272 | 273 | | |
273 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
274 | 298 | | |
275 | 299 | | |
dashboard/src/test/java/com/adsamcik/tracker/dashboard/ui/compose/cards/HumanizeResourceKeyTest.kt
Lines changed: 63 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
0 commit comments