Add badges and achievements system #18

Closed
opened 2024-01-14 14:23:56 -06:00 by jimmyb · 2 comments
Owner

MyVideoGameList needs a badges/achievements system so users can earn visible recognition for meaningful site activity such as building a game list, completing games, commenting, wishlisting games, and long-term membership.

The original issue listed many possible achievements across games, comments, reviews, blogs, forums, social accounts, favorites, and wishlists. This issue delivers the reusable badge foundation and wires enabled rules to currently supported activity sources. Review, review-comment, Discord, profile-status, Twitter, and Facebook definitions remain disabled placeholders until their supporting product flows are ready.

Scope

  • Badge and user-earned-badge persistence.
  • Badge definitions, criteria metadata, display order, and enabled/disabled state.
  • Award logic for enabled activity sources.
  • Profile display for earned badges.
  • Code-managed badge definitions.
  • Future rule hooks for rebuilt features.

Acceptance Criteria

  • The app has a reusable badge model and a durable record of which users earned which badges.
  • Badge awarding is idempotent and does not grant duplicate earned badges.
  • Users can earn enabled badges based on membership age, games added to list, completed games, concurrent playing count, profile comments left, game comments left, wishlisted games, favorites, and published blog entries.
  • Badge criteria ignore soft-deleted records where the underlying feature treats them as removed.
  • Earned badges are visible on public user profiles in a compact, readable tab.
  • Badge definitions include name, description, icon/visual asset, criteria key, threshold, display order, and enabled state.
  • Disabled review, review-comment, Discord, profile-status, Twitter, and Facebook definitions remain non-awarding placeholders, and future achievements can be enabled without changing the earned-badge storage model.
  • Award checks run after relevant user actions and through a backfill/recalculation command for existing users.
  • User-facing UI supports light/dark mode and follows existing Laravel/Tailwind site layout patterns.

Test Coverage Required

  • Feature/unit tests for badge definition loading and earned-badge persistence.
  • Tests confirming badge awards are idempotent and do not duplicate records.
  • Tests for game-list badges, including first game added, threshold counts, first completed game, completed-game thresholds, and concurrent playing thresholds.
  • Tests for profile comment, game comment, wishlist, membership-age, enabled favorite/blog badges, and disabled status/social placeholders.
  • Tests confirming soft-deleted game list, comment, wishlist, favorite, and blog records do not count toward badges.
  • Feature tests confirming earned badges render on public user profiles.
  • Command tests for badge recalculation and supported earned-date reconstruction.
  • Regression tests confirming disabled achievement categories cannot award or break badge rendering.
  • Tests use Pest and focused feature coverage.
  • Run focused affected tests, Pint, static analysis, and the frontend build before closing the issue.

Progress Checklist

  • Public user profile page exists
  • Game list persistence exists
  • Profile comment persistence exists
  • Game comment persistence exists
  • Wishlist persistence exists
  • User membership timestamps exist
  • Profile status/social profile fields exist
  • Add badge persistence and model
  • Add earned user badge persistence and relationships
  • Define initial badge catalog for currently supported activity sources
  • Add badge awarding service or action layer
  • Trigger badge checks from relevant user actions
  • Add badge recalculation/backfill command for existing users
  • Render earned badges on user profiles
  • Add optional user badge index/profile badge page
  • Prepare future rule hooks for reviews, blogs, forums, favorites, and social account linking
  • Add tests for criteria, awarding, idempotency, soft-delete filtering, profile display, and recalculation
  • Confirm the badges system can grow as legacy features are rebuilt
MyVideoGameList needs a badges/achievements system so users can earn visible recognition for meaningful site activity such as building a game list, completing games, commenting, wishlisting games, and long-term membership. The original issue listed many possible achievements across games, comments, reviews, blogs, forums, social accounts, favorites, and wishlists. This issue delivers the reusable badge foundation and wires enabled rules to currently supported activity sources. Review, review-comment, Discord, profile-status, Twitter, and Facebook definitions remain disabled placeholders until their supporting product flows are ready. ## Scope - Badge and user-earned-badge persistence. - Badge definitions, criteria metadata, display order, and enabled/disabled state. - Award logic for enabled activity sources. - Profile display for earned badges. - Code-managed badge definitions. - Future rule hooks for rebuilt features. ## Acceptance Criteria - The app has a reusable badge model and a durable record of which users earned which badges. - Badge awarding is idempotent and does not grant duplicate earned badges. - Users can earn enabled badges based on membership age, games added to list, completed games, concurrent playing count, profile comments left, game comments left, wishlisted games, favorites, and published blog entries. - Badge criteria ignore soft-deleted records where the underlying feature treats them as removed. - Earned badges are visible on public user profiles in a compact, readable tab. - Badge definitions include name, description, icon/visual asset, criteria key, threshold, display order, and enabled state. - Disabled review, review-comment, Discord, profile-status, Twitter, and Facebook definitions remain non-awarding placeholders, and future achievements can be enabled without changing the earned-badge storage model. - Award checks run after relevant user actions and through a backfill/recalculation command for existing users. - User-facing UI supports light/dark mode and follows existing Laravel/Tailwind site layout patterns. ## Test Coverage Required - Feature/unit tests for badge definition loading and earned-badge persistence. - Tests confirming badge awards are idempotent and do not duplicate records. - Tests for game-list badges, including first game added, threshold counts, first completed game, completed-game thresholds, and concurrent playing thresholds. - Tests for profile comment, game comment, wishlist, membership-age, enabled favorite/blog badges, and disabled status/social placeholders. - Tests confirming soft-deleted game list, comment, wishlist, favorite, and blog records do not count toward badges. - Feature tests confirming earned badges render on public user profiles. - Command tests for badge recalculation and supported earned-date reconstruction. - Regression tests confirming disabled achievement categories cannot award or break badge rendering. - Tests use Pest and focused feature coverage. - Run focused affected tests, Pint, static analysis, and the frontend build before closing the issue. ## Progress Checklist - [x] Public user profile page exists - [x] Game list persistence exists - [x] Profile comment persistence exists - [x] Game comment persistence exists - [x] Wishlist persistence exists - [x] User membership timestamps exist - [x] Profile status/social profile fields exist - [x] Add badge persistence and model - [x] Add earned user badge persistence and relationships - [x] Define initial badge catalog for currently supported activity sources - [x] Add badge awarding service or action layer - [x] Trigger badge checks from relevant user actions - [x] Add badge recalculation/backfill command for existing users - [x] Render earned badges on user profiles - [x] Add optional user badge index/profile badge page - [x] Prepare future rule hooks for reviews, blogs, forums, favorites, and social account linking - [x] Add tests for criteria, awarding, idempotency, soft-delete filtering, profile display, and recalculation - [x] Confirm the badges system can grow as legacy features are rebuilt
Codex changed title from Add Badges System to Add badges and achievements system 2026-05-26 00:31:04 -05:00
Codex self-assigned this 2026-08-05 13:51:47 -05:00
Member

Completed in PR #928: #928

The badge system provides durable persistence, a 60-definition code-managed catalog, idempotent evaluator/action feedback, supported historical-date reconstruction, public-profile display, and mvgl:recalculate-badges. The following remain intentionally disabled placeholders and cannot award: review, review-comment, Discord, profile status, Twitter, and Facebook. Existing awards for the latter four were removed by migration.

Final verification:

  • php artisan test --compact tests/Feature/BadgeCatalogTest.php tests/Feature/BadgeEvaluatorTest.php (17 passing)
  • vendor/bin/pint --dirty --format agent
  • composer stan
  • npm run build
Completed in PR #928: https://code.myvideogamelist.com/MyVideoGameList/myvideogamelist.com/pulls/928 The badge system provides durable persistence, a 60-definition code-managed catalog, idempotent evaluator/action feedback, supported historical-date reconstruction, public-profile display, and `mvgl:recalculate-badges`. The following remain intentionally disabled placeholders and cannot award: review, review-comment, Discord, profile status, Twitter, and Facebook. Existing awards for the latter four were removed by migration. Final verification: - `php artisan test --compact tests/Feature/BadgeCatalogTest.php tests/Feature/BadgeEvaluatorTest.php` (17 passing) - `vendor/bin/pint --dirty --format agent` - `composer stan` - `npm run build`
Member

Released to production from merged master revision 0999780.

Production deployment:

  • Uploaded the badge models, evaluator, action triggers, profile views, migrations, and Vite assets to /home/mvgl/public_html.
  • Applied migrations 2026_08_05_120000, 2026_08_10_120000, and 2026_08_11_120000.
  • Cleared Laravel optimization caches.
  • Created a recoverable pre-deploy backup at /home/mvgl/badge-deploy-backup-20260811-issue18.
  • Started the idempotent mvgl:recalculate-badges --reconstruct backfill for existing users; it is processing in the background without taking the site offline.

The disabled review, review-comment, Discord, profile-status, Twitter, and Facebook placeholders remain non-awarding; the latest migration also removes any legacy awards for the latter four.

Released to production from merged master revision `0999780`. Production deployment: - Uploaded the badge models, evaluator, action triggers, profile views, migrations, and Vite assets to `/home/mvgl/public_html`. - Applied migrations `2026_08_05_120000`, `2026_08_10_120000`, and `2026_08_11_120000`. - Cleared Laravel optimization caches. - Created a recoverable pre-deploy backup at `/home/mvgl/badge-deploy-backup-20260811-issue18`. - Started the idempotent `mvgl:recalculate-badges --reconstruct` backfill for existing users; it is processing in the background without taking the site offline. The disabled review, review-comment, Discord, profile-status, Twitter, and Facebook placeholders remain non-awarding; the latest migration also removes any legacy awards for the latter four.
Codex closed this issue 2026-08-11 09:46:28 -05:00
Sign in to join this conversation.
No milestone
No assignees
2 participants
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
MyVideoGameList/myvideogamelist.com#18
No description provided.