Update release notes and deploy workspace
This commit is contained in:
@@ -12,14 +12,24 @@ public static partial class PublicEndpoints
|
||||
var season = await db.Seasons
|
||||
.AsNoTracking()
|
||||
.Where(item => item.Year == year)
|
||||
.Select(item => new { item.Id, item.Year, item.IsCurrent, item.CurrentPhase })
|
||||
.Select(item => new { item.Id, item.Year, item.WinnersPublishedAt })
|
||||
.FirstOrDefaultAsync();
|
||||
if (season is null)
|
||||
{
|
||||
return Results.NotFound();
|
||||
}
|
||||
|
||||
if (season.IsCurrent && !CanExposeCurrentSeasonWinners(season.CurrentPhase))
|
||||
if (season.WinnersPublishedAt is null)
|
||||
{
|
||||
return Results.Ok(new WinnerArchiveResponse(year, []));
|
||||
}
|
||||
|
||||
var latestPublishedWinnerYear = await db.Results
|
||||
.AsNoTracking()
|
||||
.Where(result => result.Season.WinnersPublishedAt != null)
|
||||
.Select(result => (int?)result.Season.Year)
|
||||
.MaxAsync();
|
||||
if (latestPublishedWinnerYear == season.Year)
|
||||
{
|
||||
return Results.Ok(new WinnerArchiveResponse(year, []));
|
||||
}
|
||||
@@ -31,6 +41,7 @@ public static partial class PublicEndpoints
|
||||
.OrderBy(result => result.CategoryName)
|
||||
.Select(result => new
|
||||
{
|
||||
CategoryGroup = result.Category.GroupName,
|
||||
result.CategoryName,
|
||||
WinnerName = result.Candidate.DisplayName,
|
||||
WinnerSlug = result.Candidate.ChannelSlug,
|
||||
@@ -44,6 +55,7 @@ public static partial class PublicEndpoints
|
||||
|
||||
var items = winnerRows
|
||||
.Select(result => new WinnerArchiveItemDto(
|
||||
result.CategoryGroup,
|
||||
result.CategoryName,
|
||||
result.WinnerName,
|
||||
result.WinnerSlug,
|
||||
@@ -57,10 +69,4 @@ public static partial class PublicEndpoints
|
||||
|
||||
return Results.Ok(new WinnerArchiveResponse(year, items));
|
||||
}
|
||||
|
||||
private static bool CanExposeCurrentSeasonWinners(string currentPhase)
|
||||
{
|
||||
var phaseKey = SeasonMappings.NormalizePhaseKey(currentPhase);
|
||||
return phaseKey is "completed";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user