refactor(arena-colosseum): dedup colosseum_info source-of-truth
/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).
This commit is contained in:
@@ -688,33 +688,8 @@ public class ArenaColosseumController : SVSimController
|
||||
|
||||
// --- helpers ---
|
||||
|
||||
private static ColosseumLobbyInfo BuildColosseumInfo(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 SVSim.EmulatedEntrypoint.Models.Dtos.ColosseumSalesPeriodInfo
|
||||
{
|
||||
SalesPeriodTime = FormatTime(season.SalesPeriodEnd),
|
||||
},
|
||||
StrategyPickNum = season.StrategyPickNum > 0 ? season.StrategyPickNum : null,
|
||||
};
|
||||
}
|
||||
private static ColosseumLobbyInfo BuildColosseumInfo(ColosseumSeasonConfig season) =>
|
||||
ColosseumLobbyInfoBuilder.Build(season);
|
||||
|
||||
/// <summary>Builds the <c>colosseum_status</c> block. When the viewer has no run, every
|
||||
/// property is null and global WhenWritingNull renders <c>{}</c> — the client
|
||||
|
||||
@@ -9,6 +9,7 @@ using SVSim.Database.Services;
|
||||
using SVSim.EmulatedEntrypoint.Constants;
|
||||
using SVSim.EmulatedEntrypoint.Infrastructure;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos.ArenaColosseum;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos.Common;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests.MyPage;
|
||||
@@ -61,7 +62,7 @@ public class MyPageController : SVSimController
|
||||
|
||||
// Hydrate all the globals slices in parallel-ish — they're independent reads.
|
||||
var rotation = _config.Get<RotationConfig>();
|
||||
var colosseum = await _globalsRepository.GetCurrentColosseum();
|
||||
var colosseumSeason = _config.Get<ColosseumSeasonConfig>();
|
||||
var sealedSeason = await _globalsRepository.GetCurrentSealedSeason();
|
||||
var masterPointPeriod = await _globalsRepository.GetCurrentMasterPointPeriod();
|
||||
var bannerEntries = await _globalsRepository.GetBanners();
|
||||
@@ -93,7 +94,7 @@ public class MyPageController : SVSimController
|
||||
ArenaInfo = await BuildArenaInfosAsync(viewer.Id),
|
||||
IsArenaChallengePeriod = false, // TODO(mypage-stub): globals/ArenaSeason flag
|
||||
IsAvailableColosseumFreeEntry = false, // TODO(mypage-stub): viewer + globals free-entry quota
|
||||
ColosseumInfo = BuildColosseumInfo(colosseum),
|
||||
ColosseumInfo = ColosseumLobbyInfoBuilder.Build(colosseumSeason),
|
||||
SealedInfo = BuildSealedInfo(sealedSeason),
|
||||
Banner = bannerEntries.Select(BuildBannerInfo).ToList(),
|
||||
RoomTypeInSession = new RoomTypeInSession
|
||||
@@ -237,37 +238,6 @@ public class MyPageController : SVSimController
|
||||
};
|
||||
}
|
||||
|
||||
private ColosseumInfo BuildColosseumInfo(ColosseumConfig? row)
|
||||
{
|
||||
if (row is null) return new ColosseumInfo();
|
||||
|
||||
ColosseumSalesPeriodInfo sales = new();
|
||||
if (!string.IsNullOrEmpty(row.SalesPeriodInfo) && row.SalesPeriodInfo != "{}")
|
||||
{
|
||||
sales = JsonSerializer.Deserialize<ColosseumSalesPeriodInfo>(row.SalesPeriodInfo, JsonbReadOptions.Instance)
|
||||
?? new ColosseumSalesPeriodInfo();
|
||||
}
|
||||
|
||||
return new ColosseumInfo
|
||||
{
|
||||
ColosseumId = row.ColosseumId,
|
||||
IsDisplayTips = row.IsDisplayTips,
|
||||
TipsId = row.TipsId,
|
||||
CardPoolName = row.CardPoolName,
|
||||
IsColosseumPeriod = row.IsColosseumPeriod,
|
||||
IsRoundPeriod = row.IsRoundPeriod,
|
||||
DeckFormat = row.DeckFormat,
|
||||
IsNormalTwoPick = row.IsNormalTwoPick,
|
||||
IsSpecialMode = row.IsSpecialMode,
|
||||
IsAllCardEnabled = row.IsAllCardEnabled,
|
||||
StartTime = row.StartTime.ToString(WireDateFormat, CultureInfo.InvariantCulture),
|
||||
ColosseumName = row.ColosseumName,
|
||||
NowRound = row.NowRound,
|
||||
EndTime = row.EndTime.ToString(WireDateFormat, CultureInfo.InvariantCulture),
|
||||
SalesPeriodInfo = sales,
|
||||
};
|
||||
}
|
||||
|
||||
private SealedInfo BuildSealedInfo(SealedConfig? row)
|
||||
{
|
||||
if (row is null) return new SealedInfo();
|
||||
|
||||
Reference in New Issue
Block a user