-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update what score submission returns and show pr value
- Loading branch information
Showing
6 changed files
with
74 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 32 additions & 22 deletions
54
fluXis.Shared/API/Responses/Scores/ScoreSubmissionStats.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,55 @@ | ||
using fluXis.Shared.Components.Scores; | ||
using fluXis.Shared.Utils; | ||
using Newtonsoft.Json; | ||
|
||
namespace fluXis.Shared.API.Responses.Scores; | ||
|
||
public class ScoreSubmissionStats | ||
{ | ||
[JsonProperty("id")] | ||
public long ID { get; set; } | ||
[JsonProperty("score")] | ||
public APIScore Score { get; init; } = null!; | ||
|
||
[JsonProperty("ovr")] | ||
public double OverallRating { get; init; } | ||
public StatisticChange OverallRating { get; init; } = null!; | ||
|
||
[JsonProperty("ptr")] | ||
public double PotentialRating { get; init; } | ||
public StatisticChange PotentialRating { get; init; } = null!; | ||
|
||
[JsonProperty("rank")] | ||
public int Rank { get; init; } | ||
public StatisticChange Rank { get; init; } = null!; | ||
|
||
[JsonProperty("ovrChange")] | ||
public double OverallRatingChange { get; init; } | ||
|
||
[JsonProperty("ptrChange")] | ||
public double PotentialRatingChange { get; init; } | ||
|
||
[JsonProperty("rankChange")] | ||
public int RankChange { get; init; } | ||
|
||
public ScoreSubmissionStats(long id, double overallRating, double potentialRating, int rank, double overallRatingChange, double potentialRatingChange, int rankChange) | ||
public ScoreSubmissionStats(APIScore score, double prevOvr, double prevPtr, int prevRank, double curOvr, double curPtr, int curRank) | ||
{ | ||
ID = id; | ||
OverallRating = overallRating; | ||
PotentialRating = potentialRating; | ||
Rank = rank; | ||
OverallRatingChange = overallRatingChange; | ||
PotentialRatingChange = potentialRatingChange; | ||
RankChange = rankChange; | ||
Score = score; | ||
OverallRating = new StatisticChange(prevOvr, curOvr); | ||
PotentialRating = new StatisticChange(prevPtr, curPtr); | ||
Rank = new StatisticChange(prevRank, curRank); | ||
} | ||
|
||
[JsonConstructor] | ||
[Obsolete(JsonUtils.JSON_CONSTRUCTOR_ERROR, true)] | ||
public ScoreSubmissionStats() | ||
{ | ||
} | ||
|
||
public class StatisticChange | ||
{ | ||
[JsonProperty("prev")] | ||
public double Previous { get; init; } | ||
|
||
[JsonProperty("now")] | ||
public double Current { get; init; } | ||
|
||
public StatisticChange(double prev, double cur) | ||
{ | ||
Previous = prev; | ||
Current = cur; | ||
} | ||
|
||
[JsonConstructor] | ||
[Obsolete(JsonUtils.JSON_CONSTRUCTOR_ERROR, true)] | ||
public StatisticChange() | ||
{ | ||
} | ||
} | ||
} |