-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Correctly handle multiple online score ID types #24794
Conversation
Just as commentary: while the prerequisites of this pull will likely be obsoleted by ppy/osu-infrastructure#24, the changes in this one should still be valid. |
Are you able to split the relevant changes out? I think we're likely definitely going ahead with ppy/osu-infrastructure#24, so may as well clean things up here. |
Mostly places that can interact with imported replays. There are other places that use the online ID as a sort tiebreaker, or to check presence of a score on results screens, but they should probably still continue to only use `OnlineID`, since all scores with a legacy online ID should have an online ID, but the converse is not generally true.
Previously, for lazer scores, the ID returned from `osu-web` was discarded and replaced with -1, due to the fact that the appropriate structures for unification with stable, as well as unification across solo and multiplayer, were not in place yet. Now we're at the point where scores from all the aforementioned sources receive a `solo_scores` DB row, and as such, we can start treating `solo_scores`-scheme IDs as canonical "online IDs" for a score.
c3a4396
to
fb22938
Compare
I've just force-pushed the dependent commits out. I have not even attempted to test this yet which is why I'm keeping this as draft for the time being. I don't want this PR to go in before work on ppy/osu-infrastructure#24 is completed and verified as working correctly, as otherwise this change may do more damage than good by putting garbage data where it don't belong. |
The latter is apparently not going to be a thing anymore.
@bdach we might be at the point this can be revisited. |
As it turns out (after private-staging was sorted), legacy score import was not working quite correctly just yet. The scenario involved here is something along the lines of:
They previously wouldn't be, I pushed some commits that should make it so. 526ee6e may be a point of contention here but I think it makes sense? I can split the model jiggling out of this on request. |
I'm looking at the complexity around the replay flags and wondering why we can't switch to this: diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs
index 6ccf73d8ff..5b32f380b9 100644
--- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs
+++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs
@@ -213,7 +213,7 @@ public void CreateButtonWithNoScore()
OnlineID = hasOnlineId ? online_score_id : 0,
Ruleset = new OsuRuleset().RulesetInfo,
BeatmapInfo = beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps.First(),
- Hash = replayAvailable ? "online" : string.Empty,
+ HasOnlineReplay = replayAvailable,
User = new APIUser
{
Id = 39828,
diff --git a/osu.Game/Scoring/IScoreInfo.cs b/osu.Game/Scoring/IScoreInfo.cs
index cde48c3be3..a1d076b8c2 100644
--- a/osu.Game/Scoring/IScoreInfo.cs
+++ b/osu.Game/Scoring/IScoreInfo.cs
@@ -22,8 +22,6 @@ public interface IScoreInfo : IHasOnlineID<long>
double Accuracy { get; }
- bool HasReplay { get; }
-
long LegacyOnlineID { get; }
DateTimeOffset Date { get; }
diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs
index 722d83cac8..d712702331 100644
--- a/osu.Game/Scoring/ScoreInfo.cs
+++ b/osu.Game/Scoring/ScoreInfo.cs
@@ -94,8 +94,6 @@ public class ScoreInfo : RealmObject, IHasGuidPrimaryKey, IHasRealmFiles, ISoftD
public double Accuracy { get; set; }
- public bool HasReplay => !string.IsNullOrEmpty(Hash) || HasOnlineReplay;
-
[Ignored]
public bool HasOnlineReplay { get; set; }
diff --git a/osu.Game/Screens/Ranking/ReplayDownloadButton.cs b/osu.Game/Screens/Ranking/ReplayDownloadButton.cs
index b6166e97f6..df5f9c7a8a 100644
--- a/osu.Game/Screens/Ranking/ReplayDownloadButton.cs
+++ b/osu.Game/Screens/Ranking/ReplayDownloadButton.cs
@@ -37,7 +37,7 @@ private ReplayAvailability replayAvailability
if (State.Value == DownloadState.LocallyAvailable)
return ReplayAvailability.Local;
- if (Score.Value?.HasReplay == true)
+ if (Score.Value?.HasOnlineReplay == true)
return ReplayAvailability.Online;
return ReplayAvailability.NotAvailable;
|
Looks like we can because
so, applied. |
This is going to be hard-stuck on the dependency chain for a while; I'm only PRing it to conclude the chain of changes.
This PR executes the plan outlined in #24229 (comment) for encoding, decoding, and storing online score IDs to realm. This will finally allow stuff like replay download to fully work correctly end-to-end (although an
osu-server-spectator
bump will be required after this change for the encoder changes to propagate to replays recorded server-side.While I'm temporarily marking this as draft, most of this is generally tested full-stack to work, with the exception of stable replay handling via online download paths as testing that locally is a pain. Will do more testing (and undraft) once the dependency chain progresses enough for that to be viable.