mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-07 08:54:19 +08:00
## Summary - Moves scorable weight configuration and category filtering from global site settings to individual leaderboards - Each leaderboard can override any of the 15 score weight values and specify its own scorable categories - Score calculation now runs per leaderboard into a new `gamification_leaderboard_scores` table - Admin UI gains a "Scoring configuration" section on the leaderboard edit form ## Details Previously all leaderboards shared the same pre-calculated scores from global site settings. This made it impossible to have e.g. a "posts-only" leaderboard alongside a "likes-focused" one. Now each leaderboard can optionally override: - **Score weights**: Set per-action point values (empty = inherit global default, 0 = disabled) - **Scorable categories**: Restrict which categories count toward scoring (empty = inherit global setting) The old `gamification_scores` table is no longer written to — a post-deploy migration to drop it will follow separately. ## Test plan - [ ] Create a leaderboard with default scoring — scores match current behavior - [ ] Create a leaderboard with custom weights (e.g. `post_created` = 10, all others empty) — only overridden weights differ - [ ] Set a weight to 0 — that scorable is disabled for the leaderboard - [ ] Set per-leaderboard categories — only those categories count - [ ] Clear categories — inherits global `scorable_categories` setting - [ ] Existing leaderboards with no overrides behave identically after upgrade - [ ] Directory scores and user card scores work correctly (read from default leaderboard) - [ ] `bin/rspec plugins/discourse-gamification/spec/` — 120 examples, 0 failures |
||
|---|---|---|
| .. | ||
| 20220314190045_create_gamification_score_table.rb | ||
| 20220315172912_add_score_to_directory_items.rb | ||
| 20220324210218_create_gamification_leaderboard_table.rb | ||
| 20220331203401_add_groups_to_leaderboards.rb | ||
| 20220623182333_add_excluded_groups_to_leaderboards.rb | ||
| 20221019171131_add_default_period_to_leaderboards.rb | ||
| 20230420185415_create_gamification_score_events.rb | ||
| 20250102185307_add_period_filter_disabled_to_leaderboards.rb | ||
| 20250210133038_drop_versioned_leaderboard_materialized_views.rb | ||
| 20260402141912_create_gamification_leaderboard_scores.rb | ||
| 20260402141924_add_score_overrides_to_gamification_leaderboards.rb | ||