Add ranks, badges, personal records and a reward moment #25

Merged
berkay merged 1 commit from gamification into main 2026-11-10 22:28:40 +03:00
Owner

Requested by Berkay · project thread

Gamification for 1.0, as agreed in the BagDrill Oyunlaştırma doc. The Stitch round didn't match the app's design, so Berkay chose to have the screens built directly in Flutter from the existing components and reviewed from screenshots.

What's in it

  • Ranks: ROOKIE → AMATEUR → CONTENDER → PRO → CHAMPION. Each needs total rounds, goal weeks (weeks the weekly day goal was met, not necessarily in a row) and one long workout. Ranks never go down. New Rank screen (/rank): hero, next-rank requirement bars, the ladder with dates reached.
  • Badges: 14 badges × bronze/silver/gold + 4 hidden = 46. New Badges screen (/badges): category filter, 3-column grid with tier dots, tap for a sheet with each step and when it was earned.
  • Personal records (longest workout, most time, best week, best streak, most combos) and per-discipline counters on Progress, plus a rank card and badge row at the top.
  • Summary reward moment: "+N ROUNDS / total", new badges (stamp-in animation), new records, rank progress with this workout's gain in red; a new rank fills a black card and rings the bell.
  • Home: small rank label in the header, opens the rank screen.
  • Settings: "Rank-up bell" (on by default). It reuses the classic end-of-round bell; no new sound file.
  • Daily cap: at most 30 rounds a day count (history keeps everything).

Everything is computed from the session history (lib/domain/achievements.dart), nothing new is stored, so existing history counts from the first launch. Rewards are worked out when a workout ends, comparing history without and with it (the per-round checkpoint of the same session is not double counted).

Decisions from Berkay: gong on by default, 30-round cap, thresholds tuned for ~18 rounds/week, rank label on Home. BIG SESSION thresholds are 150/300/500 combos (the doc's 50/100/200 gave gold in a normal 6-round workout).

Screenshots

In project files, bagdrill/gamification/ (home + rank, badges + sheet, summary with rewards and with a new rank, progress). Render again with flutter test tool/screenshots/achievements_shots_test.dart.

Tests

  • test/achievements_test.dart: daily cap, goal weeks vs streaks, multi-condition ranks, badge tiers, hidden badges, long rounds, rewards (gain, badge, record, rank up, no double count).
  • Existing tests updated where Progress now shows 16 twice (total and Boxing).
  • flutter analyze clean, flutter test 131 passed, screenshot tests pass.

No APK built, no version bump.

🤖 Generated with Claude Code

https://claude.ai/code/session_015s4aKoJZdE2DV1jJq1MHvp

<!-- claude-projects-attribution --> _Requested by **Berkay** · [project thread](https://claude.ai/code/project/chan_01T5Cs4GeJAnhjXKSJKvCDa2?thread=cmsg_01T5Cs4GeJAnhjXKSJKvCDa2PMit7Fx4afYW6uXczMAydf)_ Gamification for 1.0, as agreed in the [BagDrill Oyunlaştırma doc](https://claude.ai/artifact/FHcA86toNEsgzLhcdMTQNz). The Stitch round didn't match the app's design, so Berkay chose to have the screens built directly in Flutter from the existing components and reviewed from screenshots. ## What's in it - **Ranks:** ROOKIE → AMATEUR → CONTENDER → PRO → CHAMPION. Each needs total rounds, goal weeks (weeks the weekly day goal was met, not necessarily in a row) and one long workout. Ranks never go down. New **Rank** screen (`/rank`): hero, next-rank requirement bars, the ladder with dates reached. - **Badges:** 14 badges × bronze/silver/gold + 4 hidden = 46. New **Badges** screen (`/badges`): category filter, 3-column grid with tier dots, tap for a sheet with each step and when it was earned. - **Personal records** (longest workout, most time, best week, best streak, most combos) and **per-discipline counters** on Progress, plus a rank card and badge row at the top. - **Summary reward moment:** "+N ROUNDS / total", new badges (stamp-in animation), new records, rank progress with this workout's gain in red; a new rank fills a black card and rings the bell. - **Home:** small rank label in the header, opens the rank screen. - **Settings:** "Rank-up bell" (on by default). It reuses the classic end-of-round bell; no new sound file. - **Daily cap:** at most 30 rounds a day count (history keeps everything). Everything is computed from the session history (`lib/domain/achievements.dart`), nothing new is stored, so existing history counts from the first launch. Rewards are worked out when a workout ends, comparing history without and with it (the per-round checkpoint of the same session is not double counted). Decisions from Berkay: gong on by default, 30-round cap, thresholds tuned for ~18 rounds/week, rank label on Home. BIG SESSION thresholds are 150/300/500 combos (the doc's 50/100/200 gave gold in a normal 6-round workout). ## Screenshots In project files, `bagdrill/gamification/` (home + rank, badges + sheet, summary with rewards and with a new rank, progress). Render again with `flutter test tool/screenshots/achievements_shots_test.dart`. ## Tests - `test/achievements_test.dart`: daily cap, goal weeks vs streaks, multi-condition ranks, badge tiers, hidden badges, long rounds, rewards (gain, badge, record, rank up, no double count). - Existing tests updated where Progress now shows 16 twice (total and Boxing). - `flutter analyze` clean, `flutter test` 131 passed, screenshot tests pass. No APK built, no version bump. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015s4aKoJZdE2DV1jJq1MHvp
Gamification agreed in the "BagDrill Oyunlaştırma" doc, all worked out
from the workout history (nothing new is stored, old history counts):

- Five ranks (Rookie to Champion), each needing total rounds, goal weeks
  and one long workout; ranks never drop. Rank screen with the ladder.
- 14 tiered badges plus 4 hidden ones (46 in all); badge wall with a
  filter and a sheet per badge with dates earned.
- Personal records and per-discipline counters on Progress, with a rank
  card and badge row.
- Summary shows rounds earned, new badges (stamped in), new records and
  rank progress; a new rank fills the card and rings the bell (Settings:
  "Rank-up bell", on by default).
- Small rank label in the Home header.
- At most 30 rounds a day count toward all of this.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015s4aKoJZdE2DV1jJq1MHvp
berkay merged commit 5bc2bc2ba6 into main 2026-11-10 22:28:40 +03:00
berkay deleted branch gamification 2026-11-10 22:28:40 +03:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
berkay/bagdrill!25
No description provided.