mirror of
https://github.com/osukey/osukey.git
synced 2025-05-31 18:37:32 +09:00
Merge pull request #12850 from smoogipoo/fix-score-duplication
Only ignore online score id for database import
This commit is contained in:
commit
70b36cdc0d
@ -929,11 +929,11 @@ namespace osu.Game.Screens.Play
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="score">The <see cref="Score"/> to import.</param>
|
/// <param name="score">The <see cref="Score"/> to import.</param>
|
||||||
/// <returns>The imported score.</returns>
|
/// <returns>The imported score.</returns>
|
||||||
protected virtual Task ImportScore(Score score)
|
protected virtual async Task ImportScore(Score score)
|
||||||
{
|
{
|
||||||
// Replays are already populated and present in the game's database, so should not be re-imported.
|
// Replays are already populated and present in the game's database, so should not be re-imported.
|
||||||
if (DrawableRuleset.ReplayScore != null)
|
if (DrawableRuleset.ReplayScore != null)
|
||||||
return Task.CompletedTask;
|
return;
|
||||||
|
|
||||||
LegacyByteArrayReader replayReader;
|
LegacyByteArrayReader replayReader;
|
||||||
|
|
||||||
@ -943,7 +943,18 @@ namespace osu.Game.Screens.Play
|
|||||||
replayReader = new LegacyByteArrayReader(stream.ToArray(), "replay.osr");
|
replayReader = new LegacyByteArrayReader(stream.ToArray(), "replay.osr");
|
||||||
}
|
}
|
||||||
|
|
||||||
return scoreManager.Import(score.ScoreInfo, replayReader);
|
// 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).
|
||||||
|
long? onlineScoreId = score.ScoreInfo.OnlineScoreID;
|
||||||
|
score.ScoreInfo.OnlineScoreID = null;
|
||||||
|
|
||||||
|
await scoreManager.Import(score.ScoreInfo, replayReader).ConfigureAwait(false);
|
||||||
|
|
||||||
|
// ... And restore the online ID for other processes to handle correctly (e.g. de-duplication for the results screen).
|
||||||
|
score.ScoreInfo.OnlineScoreID = onlineScoreId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -116,12 +116,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
request.Success += s =>
|
request.Success += s =>
|
||||||
{
|
{
|
||||||
// For the time being, online ID responses are not really useful for anything.
|
score.ScoreInfo.OnlineScoreID = s.ID;
|
||||||
// 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).
|
|
||||||
// score.ScoreInfo.OnlineScoreID = s.ID;
|
|
||||||
tcs.SetResult(true);
|
tcs.SetResult(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user