mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-25 15:08:47 -07:00
Refactor leaderboard logic: incorporate room context into leaderboard stats and channel metadata handling
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
namespace DorkNet.Server.Data.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Admin-curated metadata for a leaderboard <c>StatChannel</c> id. The
|
||||
/// Admin-curated metadata for a room-scoped leaderboard
|
||||
/// <c>StatChannel</c> id. The
|
||||
/// 2020 watch reports raw integer channel ids via
|
||||
/// <c>POST api/Leaderboard/v1/SetStats</c>; this table lets admins map
|
||||
/// each channel to a specific room (so the room detail page can list
|
||||
@@ -9,22 +10,19 @@ namespace DorkNet.Server.Data.Entities;
|
||||
/// here override the hardcoded <c>AdminController.KnownStatChannels</c>
|
||||
/// fallback. Channels with no row stay listed as "Channel N".
|
||||
///
|
||||
/// One channel id, one row. Repeated <c>SetStats</c> calls for the same
|
||||
/// channel from any room write to that channel's value rows; the meta
|
||||
/// row only changes when an admin renames or re-maps it.
|
||||
/// One row per (room, channel). Repeated <c>SetStats</c> calls for the
|
||||
/// same channel in different rooms do not share metadata or values.
|
||||
/// </summary>
|
||||
public class LeaderboardChannelMetaEntity
|
||||
{
|
||||
/// <summary>Same int the watch reports for this channel. Primary
|
||||
/// key — there's only ever one meta row per channel.</summary>
|
||||
public int Channel { get; set; }
|
||||
|
||||
/// <summary>Room this channel "belongs to" for the per-room detail
|
||||
/// view. 0 = global / unscoped (e.g. cross-room player progression
|
||||
/// counters). The same room can own many channels (e.g. Stunt
|
||||
/// Runner has one channel per course).</summary>
|
||||
/// view. 0 = global / unscoped legacy bucket.</summary>
|
||||
public long RoomId { get; set; }
|
||||
|
||||
/// <summary>Same int the watch reports for this channel. Only unique
|
||||
/// together with <see cref="RoomId"/>.</summary>
|
||||
public int Channel { get; set; }
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>When true, a lower stored value is a better score (race
|
||||
|
||||
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user