@@ -54,8 +54,6 @@ public async Task UpdateGame(Game game, CancellationToken token = default)
5454 public Task < Game ? > GetGameById ( int id , CancellationToken token = default ) =>
5555 Context . Games . FirstOrDefaultAsync ( x => x . Id == id , token ) ;
5656
57- public Task < int > CountGames ( CancellationToken token = default ) => Context . Games . CountAsync ( token ) ;
58-
5957 public Task < int [ ] > GetUpcomingGames ( CancellationToken token = default ) =>
6058 Context . Games . Where ( g => g . StartTimeUtc > DateTime . UtcNow
6159 && g . StartTimeUtc - DateTime . UtcNow < TimeSpan . FromMinutes ( 15 ) )
@@ -78,7 +76,7 @@ public Task<BasicGameInfoModel[]> FetchGameList(int count, int skip, Cancellatio
7876 public async Task < ArrayResponse < BasicGameInfoModel > > GetGameInfo ( int count = 20 , int skip = 0 ,
7977 CancellationToken token = default )
8078 {
81- var total = await CountGames ( token ) ;
79+ var total = await Context . Games . CountAsync ( game => ! game . Hidden , token ) ;
8280 if ( skip >= total )
8381 return new ( [ ] , total ) ;
8482
@@ -305,18 +303,17 @@ public async Task<ScoreboardModel> GenScoreboard(Game game, CancellationToken to
305303 . Select ( g =>
306304 g . OrderBy ( s => s . SubmitTimeUtc )
307305 . Take ( 1 )
308- . Select (
309- s =>
310- new ChallengeItem
311- {
312- Id = s . ChallengeId ,
313- UserName = s . UserName ,
314- SubmitTimeUtc = s . SubmitTimeUtc ,
315- ParticipantId = s . ParticipationId ,
316- // pending fields
317- Score = 0 ,
318- Type = SubmissionType . Normal
319- }
306+ . Select ( s =>
307+ new ChallengeItem
308+ {
309+ Id = s . ChallengeId ,
310+ UserName = s . UserName ,
311+ SubmitTimeUtc = s . SubmitTimeUtc ,
312+ ParticipantId = s . ParticipationId ,
313+ // pending fields
314+ Score = 0 ,
315+ Type = SubmissionType . Normal
316+ }
320317 )
321318 . First ( )
322319 )
0 commit comments