89 lines
3.3 KiB
C#
89 lines
3.3 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace LaDOSE.Entity
|
|
{
|
|
/// <summary>
|
|
/// Every recorded meeting between two players, broken down per game.
|
|
/// Not an entity: computed in memory by StatisticsService and mapped to
|
|
/// PlayerVersusDTO by AutoMapper, same as <see cref="MatchStats"/>.
|
|
/// Property names must stay identical to the DTO's, the mapping is by convention.
|
|
///
|
|
/// A <see cref="Set"/> carries no game of its own — the game comes from the
|
|
/// <see cref="Tournament"/> the set belongs to, and that Tournament.GameId is
|
|
/// nullable. Sets behind a bracket with no game are counted in
|
|
/// <see cref="UnknownGameSets"/> and excluded from everything else, because a
|
|
/// per-game breakdown cannot say anything about them.
|
|
/// </summary>
|
|
public class PlayerVersus
|
|
{
|
|
public int PlayerAId { get; set; }
|
|
|
|
/// <summary>Gamertag, falling back to Name, else "#<id>".</summary>
|
|
public string PlayerA { get; set; }
|
|
|
|
public int PlayerBId { get; set; }
|
|
|
|
public string PlayerB { get; set; }
|
|
|
|
/// <summary>Meetings in a bracket whose game is known — the sum of the rows below.</summary>
|
|
public int Sets { get; set; }
|
|
|
|
/// <summary>Of those, the ones with a determinable winner (unequal scores).</summary>
|
|
public int DecidedSets { get; set; }
|
|
|
|
public int WinsA { get; set; }
|
|
public int WinsB { get; set; }
|
|
|
|
/// <summary>
|
|
/// Meetings dropped because the bracket has no game attached. Reported rather
|
|
/// than hidden: it is the difference between "they never met" and "we cannot
|
|
/// tell which game they met in".
|
|
/// </summary>
|
|
public int UnknownGameSets { get; set; }
|
|
|
|
/// <summary>One row per game they actually met in, most-played first.</summary>
|
|
public List<VersusGameStats> Games { get; set; } = new List<VersusGameStats>();
|
|
}
|
|
|
|
/// <summary>One game's slice of a <see cref="PlayerVersus"/>.</summary>
|
|
public class VersusGameStats
|
|
{
|
|
public int GameId { get; set; }
|
|
|
|
/// <summary>Game.Name, or "#<id>" when the game row is gone.</summary>
|
|
public string Game { get; set; }
|
|
|
|
public string GameLongName { get; set; }
|
|
|
|
/// <summary>Meetings in this game, decided or not.</summary>
|
|
public int Sets { get; set; }
|
|
|
|
/// <summary>Meetings with a determinable winner. Always equals WinsA + WinsB.</summary>
|
|
public int DecidedSets { get; set; }
|
|
|
|
public int WinsA { get; set; }
|
|
public int WinsB { get; set; }
|
|
|
|
/// <summary>Individual games won inside the decided sets (a DQ, stored as -1, clamps to 0).</summary>
|
|
public int GamesWonA { get; set; }
|
|
|
|
public int GamesWonB { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// A player who can be picked for a versus lookup, i.e. one with at least one set
|
|
/// in a bracket whose game is known. Offering anyone else would mean offering
|
|
/// players the breakdown must then report as empty.
|
|
/// </summary>
|
|
public class PlayerOption
|
|
{
|
|
public int Id { get; set; }
|
|
|
|
/// <summary>Gamertag, falling back to Name, else "#<id>".</summary>
|
|
public string Name { get; set; }
|
|
|
|
/// <summary>Sets in a bracket with a known game, whoever the opponent was.</summary>
|
|
public int Sets { get; set; }
|
|
}
|
|
}
|