/mypage/index data.colosseum_info and /arena_colosseum/{top,get_fee_info}
now both project through ColosseumLobbyInfoBuilder.Build(ColosseumSeasonConfig).
One source of truth for the home-tab gating and the lobby reads — admins
flip the season on by writing to GameConfigs (per the runbook), no second
table to keep in sync.
* New ColosseumLobbyInfoBuilder — static projection from ColosseumSeasonConfig
to the wire ColosseumLobbyInfo. Replaces ArenaColosseumController's private
BuildColosseumInfo and MyPageController's BuildColosseumInfo(ColosseumConfig).
* MyPageController reads ColosseumSeasonConfig via IGameConfigService; the
IGlobalsRepository.GetCurrentColosseum() call goes away.
* MyPageIndexResponse.ColosseumInfo retyped to the new ColosseumLobbyInfo.
* ColosseumSalesPeriodInfo relocated into the ArenaColosseum namespace
alongside the rest of the family DTOs.
* Drops: Colosseums DB table (migration DropColosseumsTable), ColosseumConfig
entity, the captured-shape Models.Dtos.ColosseumInfo DTO, ColosseumSeed,
MyPageGlobalsImporter.ImportColosseumAsync + seed file colosseum.json,
IGlobalsRepository.GetCurrentColosseum + impl, the two related tests.
Net: home-screen Grand Prix tab now hidden by default because the season
ships with IsColosseumPeriod=false. Full suite: 1345/1345 (was 1347 — the
2 dropped tests covered the now-dead surface).
49 lines
2.0 KiB
C#
49 lines
2.0 KiB
C#
using System.Globalization;
|
|
using SVSim.Database.Models.Config;
|
|
|
|
namespace SVSim.EmulatedEntrypoint.Models.Dtos.ArenaColosseum;
|
|
|
|
/// <summary>
|
|
/// Single source of truth for projecting <see cref="ColosseumSeasonConfig"/> onto the wire
|
|
/// <see cref="ColosseumLobbyInfo"/> block. Used by both <c>/arena_colosseum/{top,get_fee_info}</c>
|
|
/// AND <c>/mypage/index data.colosseum_info</c> — the home-screen tab and the lobby reads
|
|
/// must agree on the season state, so they go through one builder. When
|
|
/// <c>IsColosseumPeriod = false</c> the minimal "no event" payload is emitted; the client
|
|
/// gates every other field on that flag (<c>Wizard/ColosseumEntryInfoTask.cs:100</c>).
|
|
/// </summary>
|
|
public static class ColosseumLobbyInfoBuilder
|
|
{
|
|
private const string WireDateFormat = "yyyy-MM-dd HH:mm:ss";
|
|
|
|
public static ColosseumLobbyInfo Build(ColosseumSeasonConfig season)
|
|
{
|
|
if (!season.IsColosseumPeriod)
|
|
{
|
|
return new ColosseumLobbyInfo { IsColosseumPeriod = false };
|
|
}
|
|
|
|
return new ColosseumLobbyInfo
|
|
{
|
|
IsColosseumPeriod = true,
|
|
DeckFormat = (int)season.DeckFormat,
|
|
IsNormalTwoPick = season.IsNormalTwoPick ? "1" : "0",
|
|
ColosseumName = season.ColosseumName,
|
|
IsRoundPeriod = true,
|
|
IsSpecialMode = season.IsSpecialMode,
|
|
CardPoolName = string.IsNullOrEmpty(season.CardPoolName) ? null : season.CardPoolName,
|
|
NowRound = 1,
|
|
StartTime = FormatTime(season.EventStartTime),
|
|
EndTime = FormatTime(season.EventEndTime),
|
|
IsAllCardEnabled = season.IsAllCardEnabled ? 1 : 0,
|
|
SalesPeriodInfo = new ColosseumSalesPeriodInfo
|
|
{
|
|
SalesPeriodTime = FormatTime(season.SalesPeriodEnd),
|
|
},
|
|
StrategyPickNum = season.StrategyPickNum > 0 ? season.StrategyPickNum : null,
|
|
};
|
|
}
|
|
|
|
private static string FormatTime(DateTime t) =>
|
|
t == default ? "" : t.ToString(WireDateFormat, CultureInfo.InvariantCulture);
|
|
}
|