diff --git a/osu.Game/Online/ScoreDownloadTracker.cs b/osu.Game/Online/ScoreDownloadTracker.cs index 08362448a3..b34586567d 100644 --- a/osu.Game/Online/ScoreDownloadTracker.cs +++ b/osu.Game/Online/ScoreDownloadTracker.cs @@ -47,7 +47,7 @@ protected override void LoadComplete() Downloader.DownloadBegan += downloadBegan; Downloader.DownloadFailed += downloadFailed; - realmSubscription = realmContextFactory.Context.All().Where(s => s.OnlineID == TrackedItem.OnlineID && !s.DeletePending).QueryAsyncWithNotifications((items, changes, ___) => + realmSubscription = realmContextFactory.Context.All().Where(s => ((s.OnlineID > 0 && s.OnlineID == TrackedItem.OnlineID) || s.Hash == TrackedItem.Hash) && !s.DeletePending).QueryAsyncWithNotifications((items, changes, ___) => { if (items.Any()) Schedule(() => UpdateState(DownloadState.LocallyAvailable)); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 9fc0d70cc0..ff3fea51cf 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -18,6 +18,7 @@ using osu.Framework.Threading; using osu.Game.Beatmaps; using osu.Game.Configuration; +using osu.Game.Database; using osu.Game.Graphics.Containers; using osu.Game.IO.Archives; using osu.Game.Online.API; @@ -1038,17 +1039,17 @@ protected virtual async Task ImportScore(Score score) replayReader = new LegacyByteArrayReader(stream.ToArray(), "replay.osr"); } - // the import process will re-attach managed beatmap/rulesets to this score. we don't want this for now, so create a temporary copy to import. - var importableScore = score.ScoreInfo.DeepClone(); - // For the time being, online ID responses are not really useful for anything. // In addition, the IDs provided via new (lazer) endpoints are based on a different autoincrement from legacy (stable) scores. // // Until we better define the server-side logic behind this, let's not store the online ID to avoid potential unique constraint // conflicts across various systems (ie. solo and multiplayer). - importableScore.OnlineID = -1; + score.ScoreInfo.OnlineID = -1; - await scoreManager.Import(importableScore, replayReader).ConfigureAwait(false); + var imported = await scoreManager.Import(score.ScoreInfo, replayReader).ConfigureAwait(false); + + // detach post-import as we want to keep using the score for display in results. + score.ScoreInfo = imported.PerformRead(s => s.Detach()); } ///