Skip to content

Commit

Permalink
Merge pull request #253 from peppy/verify-ranked-state
Browse files Browse the repository at this point in the history
Add verify step to confirm correct `ranked` flag
  • Loading branch information
bdach authored Apr 15, 2024
2 parents 5303c55 + 0ce882a commit bcb42e0
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public async Task<int> OnExecuteAsync(CancellationToken cancellationToken)
+ "`legacy_total_score`, "
+ "`total_score`, "
+ "`has_replay`, "
+ "s.ranked,"
+ "s.`rank`, "
+ "s.`pp`, "
+ "h.* "
Expand Down Expand Up @@ -188,6 +189,13 @@ public async Task<int> OnExecuteAsync(CancellationToken cancellationToken)
sqlBuffer.Append($"UPDATE scores SET pp = {importedScore.HighScore.pp.ToString() ?? "NULL"} WHERE id = {importedScore.id};");
}

if (!check(importedScore.id, "ranked", importedScore.ranked, true))
{
Interlocked.Increment(ref fail);
requiresIndexing = true;
sqlBuffer.Append($"UPDATE scores SET ranked = 1 WHERE id = {importedScore.id};");
}

if (!check(importedScore.id, "replay", importedScore.has_replay, importedScore.HighScore.replay))
{
Interlocked.Increment(ref fail);
Expand Down Expand Up @@ -300,6 +308,7 @@ public class ComparableScore
public long? total_score;
public bool has_replay;
public ScoreRank rank;
public bool ranked;
public float? pp;

public HighScore? HighScore { get; set; }
Expand Down

0 comments on commit bcb42e0

Please sign in to comment.