Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add verify step to confirm correct ranked flag #253

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this implicitly assumes that every score in the high tables is automatically ranked, but what about the hidden flag in those tables? Are we handling that elsewhere already? I don't think we are, or at least I can't see it happening in code...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hidden is exclusively used for restricted users, which is handled as part of the ES indexing step these days. So for the time being we do just import these scores to the new table with no consideration of the flag, and leave that to es indexer to get right.

{
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