Refactor leaderboard logic: incorporate room context into leaderboard stats and channel metadata handling

This commit is contained in:
Alexa
2026-06-05 23:55:26 +03:00
parent 97e0fa5716
commit fe1c2c53e3
10 changed files with 257 additions and 106 deletions
@@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
namespace DorkNet.Server.Data.Entities;
/// <summary>
/// One leaderboard stat row per (player, statChannel). Backs
/// One leaderboard stat row per (room, player, statChannel). Backs
/// <c>api/Leaderboard/v1/SetStats</c> + <c>api/Leaderboard/v2/getPlayerRank</c>.
///
/// The 2020 watch's <c>RecNet.Leaderboards</c> uses an int channel
@@ -17,6 +17,11 @@ public class LeaderboardStatEntity
public long Id { get; set; }
public long PlayerId { get; set; }
/// <summary>Room the score was reported from. The same stat channel
/// id is reused by different rooms, so room scope is part of the
/// leaderboard identity. 0 means legacy/global/unscoped.</summary>
public long RoomId { get; set; }
/// <summary>RecNet stat channel id (small int per game mode +
/// stat type — e.g. paintball-CTF-wins, dodgeball-hits).</summary>
public int StatChannel { get; set; }