@@ -54,8 +54,6 @@ public async Task UpdateGame(Game game, CancellationToken token = default)
54
54
public Task < Game ? > GetGameById ( int id , CancellationToken token = default ) =>
55
55
Context . Games . FirstOrDefaultAsync ( x => x . Id == id , token ) ;
56
56
57
- public Task < int > CountGames ( CancellationToken token = default ) => Context . Games . CountAsync ( token ) ;
58
-
59
57
public Task < int [ ] > GetUpcomingGames ( CancellationToken token = default ) =>
60
58
Context . Games . Where ( g => g . StartTimeUtc > DateTime . UtcNow
61
59
&& g . StartTimeUtc - DateTime . UtcNow < TimeSpan . FromMinutes ( 15 ) )
@@ -78,7 +76,7 @@ public Task<BasicGameInfoModel[]> FetchGameList(int count, int skip, Cancellatio
78
76
public async Task < ArrayResponse < BasicGameInfoModel > > GetGameInfo ( int count = 20 , int skip = 0 ,
79
77
CancellationToken token = default )
80
78
{
81
- var total = await CountGames ( token ) ;
79
+ var total = await Context . Games . CountAsync ( game => ! game . Hidden , token ) ;
82
80
if ( skip >= total )
83
81
return new ( [ ] , total ) ;
84
82
@@ -305,18 +303,17 @@ public async Task<ScoreboardModel> GenScoreboard(Game game, CancellationToken to
305
303
. Select ( g =>
306
304
g . OrderBy ( s => s . SubmitTimeUtc )
307
305
. 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
+ }
320
317
)
321
318
. First ( )
322
319
)
0 commit comments