Move transferal of `LegacyTotalScore` back to original spot

This subtle detail was messing with server-side score import flows.
Server-side, legacy total score will *already* be in `LegacyTotalScore`
from the start, and `TotalScore` will be zero until recomputed via
`StandardisedScoreMigrationTools.UpdateFromLegacy()` - so in that
context, attempting to move it across is incorrect.
This commit is contained in:
Bartłomiej Dach 2024-01-23 11:05:29 +01:00
parent 0cf90677e6
commit cb87d6ce50
No known key found for this signature in database
2 changed files with 7 additions and 3 deletions

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using osu.Framework.Logging;
using osu.Game.Beatmaps;
@ -316,12 +317,11 @@ private static long convertFromLegacyTotalScore(ScoreInfo score, Ruleset ruleset
if (!score.IsLegacyScore)
return score.TotalScore;
Debug.Assert(score.LegacyTotalScore != null);
if (ruleset is not ILegacyRuleset legacyRuleset)
return score.TotalScore;
// ensure legacy total score is saved for later.
score.LegacyTotalScore = score.TotalScore;
double legacyModMultiplier = legacyRuleset.CreateLegacyScoreSimulator().GetLegacyScoreMultiplier(score.Mods, difficulty);
int maximumLegacyAccuracyScore = attributes.AccuracyScore;
long maximumLegacyComboScore = (long)Math.Round(attributes.ComboScore * legacyModMultiplier);

View File

@ -134,6 +134,10 @@ public Score Parse(Stream stream)
}
PopulateMaximumStatistics(score.ScoreInfo, workingBeatmap);
if (score.ScoreInfo.IsLegacyScore)
score.ScoreInfo.LegacyTotalScore = score.ScoreInfo.TotalScore;
StandardisedScoreMigrationTools.UpdateFromLegacy(score.ScoreInfo, workingBeatmap);
// before returning for database import, we must restore the database-sourced BeatmapInfo.