1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:43:05 +08:00

Merge pull request #28171 from bdach/present-score-different-hashes

Use hash rather than online ID as primary lookup key when presenting score
This commit is contained in:
Dean Herbert 2024-05-14 23:39:54 +08:00 committed by GitHub
commit c31b503f2a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 4 deletions

View File

@ -145,6 +145,19 @@ namespace osu.Game.Tests.Visual.Navigation
presentAndConfirm(secondImport, type); presentAndConfirm(secondImport, type);
} }
[Test]
public void TestPresentTwoImportsWithSameOnlineIDButDifferentHashes([Values] ScorePresentType type)
{
AddStep("enter song select", () => Game.ChildrenOfType<ButtonSystem>().Single().OnSolo?.Invoke());
AddUntilStep("song select is current", () => Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect && songSelect.BeatmapSetsLoaded);
var firstImport = importScore(1);
presentAndConfirm(firstImport, type);
var secondImport = importScore(1);
presentAndConfirm(secondImport, type);
}
private void returnToMenu() private void returnToMenu()
{ {
// if we don't pause, there's a chance the track may change at the main menu out of our control (due to reaching the end of the track). // if we don't pause, there's a chance the track may change at the main menu out of our control (due to reaching the end of the track).

View File

@ -88,15 +88,15 @@ namespace osu.Game.Scoring
{ {
ScoreInfo? databasedScoreInfo = null; ScoreInfo? databasedScoreInfo = null;
if (originalScoreInfo is ScoreInfo scoreInfo)
databasedScoreInfo = Query(s => s.Hash == scoreInfo.Hash);
if (originalScoreInfo.OnlineID > 0) if (originalScoreInfo.OnlineID > 0)
databasedScoreInfo = Query(s => s.OnlineID == originalScoreInfo.OnlineID); databasedScoreInfo ??= Query(s => s.OnlineID == originalScoreInfo.OnlineID);
if (originalScoreInfo.LegacyOnlineID > 0) if (originalScoreInfo.LegacyOnlineID > 0)
databasedScoreInfo ??= Query(s => s.LegacyOnlineID == originalScoreInfo.LegacyOnlineID); databasedScoreInfo ??= Query(s => s.LegacyOnlineID == originalScoreInfo.LegacyOnlineID);
if (originalScoreInfo is ScoreInfo scoreInfo)
databasedScoreInfo ??= Query(s => s.Hash == scoreInfo.Hash);
if (databasedScoreInfo == null) if (databasedScoreInfo == null)
{ {
Logger.Log("The requested score could not be found locally.", LoggingTarget.Information); Logger.Log("The requested score could not be found locally.", LoggingTarget.Information);