Skip to content

Commit 48aa522

Browse files
committed
Merge branch 'work' into ci/test-satori
2 parents 3607a1b + 1730626 commit 48aa522

File tree

3 files changed

+13
-23
lines changed

3 files changed

+13
-23
lines changed

src/Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<PackageVersion Include="OpenTelemetry.Instrumentation.Process" Version="1.11.0-beta.1" />
3737
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.12.0" />
3838
<PackageVersion Include="OpenTelemetry.Instrumentation.StackExchangeRedis" Version="1.12.0-beta.1" />
39-
<PackageVersion Include="Scalar.AspNetCore" Version="2.4.22" />
39+
<PackageVersion Include="Scalar.AspNetCore" Version="2.5.0" />
4040
<PackageVersion Include="Serilog.AspNetCore" Version="9.0.0" />
4141
<PackageVersion Include="Serilog.Expressions" Version="5.0.0" />
4242
<PackageVersion Include="Serilog.Extensions.Logging" Version="9.0.2" />

src/GZCTF/Repositories/GameRepository.cs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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
)

src/GZCTF/Repositories/Interface/IGameRepository.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@ public Task<ArrayResponse<BasicGameInfoModel>> GetGameInfo(int count = 10, int s
3232
/// <returns></returns>
3333
public Task<Game[]> GetGames(int count = 10, int skip = 0, CancellationToken token = default);
3434

35-
/// <summary>
36-
/// 获取比赛数量
37-
/// </summary>
38-
/// <param name="token"></param>
39-
/// <returns></returns>
40-
public Task<int> CountGames(CancellationToken token = default);
41-
4235
/// <summary>
4336
/// 获取最近将要开始的比赛 id
4437
/// </summary>

0 commit comments

Comments
 (0)