Skip to content

Commit

Permalink
feat(scoreboard): export user email in scoreboard table
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Nov 25, 2024
1 parent 657fccf commit 75d7e3d
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 71 deletions.
62 changes: 24 additions & 38 deletions src/GZCTF.Test/GZCTF.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,42 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<CollectCoverage>true</CollectCoverage>
<Configurations>Debug;Release;GenAPI</Configurations>
<ReleaseVersion>1.0.2</ReleaseVersion>
<EnablePreviewFeatures>True</EnablePreviewFeatures>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<CollectCoverage>true</CollectCoverage>
<Configurations>Debug;Release;GenAPI</Configurations>
<ReleaseVersion>1.0.2</ReleaseVersion>
<EnablePreviewFeatures>True</EnablePreviewFeatures>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing"/>
<PackageReference Include="Microsoft.AspNetCore.TestHost"/>
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="xunit"/>
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="xunit.runner.console">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\GZCTF\GZCTF.csproj"/>
<None Include="..\GZCTF\appsettings*"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio"/>
<PackageReference Include="xunit.runner.console"/>
<PackageReference Include="coverlet.collector"/>
<PackageReference Include="coverlet.msbuild"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\GZCTF\GZCTF.csproj" />
<None Include="..\GZCTF\appsettings*" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/GZCTF/ClientApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "tsc && vite build",
"preview": "vite preview",
"prettier": "prettier --write src",
"genapi": "swagger-typescript-api -p http://localhost:55000/swagger/v1/swagger.json -t template -o src --module-name-first-tag --sort-routes"
"genapi": "swagger-typescript-api -p http://localhost:55000/openapi/v1.json -t template -o src --module-name-first-tag --sort-routes"
},
"dependencies": {
"@babel/core": "^7.26.0",
Expand All @@ -36,7 +36,7 @@
"embla-carousel": "^8.5.1",
"embla-carousel-autoplay": "^8.5.1",
"embla-carousel-react": "^8.5.1",
"i18next": "^24.0.0",
"i18next": "^24.0.1",
"i18next-browser-languagedetector": "^8.0.0",
"katex": "^0.16.11",
"lz-string": "^1.5.0",
Expand Down
16 changes: 8 additions & 8 deletions src/GZCTF/ClientApp/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 4 additions & 16 deletions src/GZCTF/GZCTF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aigamo.ResXGenerator">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Aigamo.ResXGenerator"/>
<PackageReference Include="Azure.Monitor.OpenTelemetry.AspNetCore" />
<PackageReference Include="Docker.DotNet" />
<PackageReference Include="Docker.DotNet.BasicAuth" />
Expand All @@ -43,22 +40,13 @@
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.Json" />
<PackageReference Include="Microsoft.AspNetCore.SpaProxy" />
<PackageReference Include="Microsoft.EntityFrameworkCore" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tasks">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tasks"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools"/>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" />
<PackageReference Include="Npgsql.OpenTelemetry" />
<PackageReference Include="NPOI" />
<PackageReference Include="NSwag.AspNetCore" />
<PackageReference Include="NSwag.MSBuild">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NSwag.MSBuild"/>
<PackageReference Include="OpenTelemetry.Exporter.Console" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" />
<PackageReference Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" />
Expand Down
1 change: 1 addition & 0 deletions src/GZCTF/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@
options.PostProcess += (document, _) => document.Servers.Clear();
options.Path = "/openapi/{documentName}.json";
});
// open ui in `/scalar/v1`
app.MapScalarApiReference();
}
else
Expand Down
18 changes: 11 additions & 7 deletions src/GZCTF/Utils/ExcelHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class ExcelHelper(IStringLocalizer<Program> localizer)
localizer[nameof(Resources.Program.Header_Team)],
localizer[nameof(Resources.Program.Header_Captain)],
localizer[nameof(Resources.Program.Header_Member)],
localizer[nameof(Resources.Program.Header_Email)],
localizer[nameof(Resources.Program.Header_StdNumber)],
localizer[nameof(Resources.Program.Header_PhoneNumber)],
localizer[nameof(Resources.Program.Header_SolvedNumber)],
Expand Down Expand Up @@ -93,14 +94,15 @@ void WriteSubmissionContent(ISheet sheet, IEnumerable<Submission> submissions)

foreach (Submission item in submissions)
{
var colIndex = 0;
IRow? row = sheet.CreateRow(rowIndex);
row.CreateCell(0).SetCellValue(item.Status.ToShortString(localizer));
row.CreateCell(1).SetCellValue(item.SubmitTimeUtc.ToString("u"));
row.CreateCell(2).SetCellValue(item.TeamName);
row.CreateCell(3).SetCellValue(item.UserName);
row.CreateCell(4).SetCellValue(item.ChallengeName);
row.CreateCell(5).SetCellValue(item.Answer);
row.CreateCell(6).SetCellValue(item.User?.Email ?? string.Empty);
row.CreateCell(colIndex++).SetCellValue(item.Status.ToShortString(localizer));
row.CreateCell(colIndex++).SetCellValue(item.SubmitTimeUtc.ToString("u"));
row.CreateCell(colIndex++).SetCellValue(item.TeamName);
row.CreateCell(colIndex++).SetCellValue(item.UserName);
row.CreateCell(colIndex++).SetCellValue(item.ChallengeName);
row.CreateCell(colIndex++).SetCellValue(item.Answer);
row.CreateCell(colIndex).SetCellValue(item.User?.Email ?? string.Empty);

rowIndex++;
}
Expand Down Expand Up @@ -160,6 +162,8 @@ static void WriteBoardContent(ISheet sheet, ScoreboardModel scoreboard, int[] ch

row.CreateCell(colIndex++)
.SetCellValue(string.Join(Split, members.Select(m => TakeIfNotEmpty(m.RealName))));
row.CreateCell(colIndex++)
.SetCellValue(string.Join(Split, members.Select(m => TakeIfNotEmpty(m.Email))));
row.CreateCell(colIndex++)
.SetCellValue(string.Join(Split, members.Select(m => TakeIfNotEmpty(m.StdNumber))));
row.CreateCell(colIndex++)
Expand Down

0 comments on commit 75d7e3d

Please sign in to comment.