Skip to content

Commit

Permalink
fix(http): ContestResult type (#321)
Browse files Browse the repository at this point in the history
* Update run.sh

* Update HttpSender.cs

* fix(http): ContestResult type
  • Loading branch information
xiangmy21 authored May 7, 2024
1 parent df66e5d commit 87f7b70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion logic/Server/GameServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ namespace Server
{
public class ContestResult
{
public int score;
public string status;
public int[] scores;
}
partial class GameServer : ServerBase
{
Expand Down
4 changes: 2 additions & 2 deletions logic/Server/HttpSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public async Task<double[]> GetLadderScore(double[] scores)
var jsonString = await response.Content.ReadAsStringAsync();

// 解析 JSON 字符串
var result = JsonConvert.DeserializeObject<ResponseResult>(jsonString);
return result.Scores.Select(score => (double)score).ToArray();;
var result = JsonConvert.DeserializeObject<ContestResult>(jsonString);
return result.Scores.Select(score => (double)score).ToArray();

Check failure on line 62 in logic/Server/HttpSender.cs

View workflow job for this annotation

GitHub Actions / dotnet-build-logic

'ContestResult' does not contain a definition for 'Scores' and no accessible extension method 'Scores' accepting a first argument of type 'ContestResult' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 62 in logic/Server/HttpSender.cs

View workflow job for this annotation

GitHub Actions / dotnet-build-logic

'ContestResult' does not contain a definition for 'Scores' and no accessible extension method 'Scores' accepting a first argument of type 'ContestResult' could be found (are you missing a using directive or an assembly reference?)
}
catch (Exception e)
{
Expand Down

0 comments on commit 87f7b70

Please sign in to comment.