mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Move preconditions to realm migration step to simplify marker version logic
This commit is contained in:
parent
1629024111
commit
a0c3fa9c13
@ -14,7 +14,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Rulesets;
|
||||
@ -199,23 +198,9 @@ namespace osu.Game
|
||||
|
||||
private void convertLegacyTotalScoreToStandardised()
|
||||
{
|
||||
HashSet<Guid> scoreIds = new HashSet<Guid>();
|
||||
|
||||
Logger.Log("Querying for scores that need total score conversion...");
|
||||
|
||||
realmAccess.Run(r =>
|
||||
{
|
||||
foreach (var score in r.All<ScoreInfo>().Where(s => s.IsLegacyScore))
|
||||
{
|
||||
if (!score.Ruleset.IsLegacyRuleset())
|
||||
continue;
|
||||
|
||||
if (score.Version >= 30000003)
|
||||
continue;
|
||||
|
||||
scoreIds.Add(score.ID);
|
||||
}
|
||||
});
|
||||
HashSet<Guid> scoreIds = realmAccess.Run(r => new HashSet<Guid>(r.All<ScoreInfo>().Where(s => s.Version == 30000002).Select(s => s.ID)));
|
||||
|
||||
Logger.Log($"Found {scoreIds.Count} scores which require total score conversion.");
|
||||
|
||||
|
@ -970,16 +970,15 @@ namespace osu.Game.Database
|
||||
|
||||
case 31:
|
||||
{
|
||||
var scores = migration.NewRealm.All<ScoreInfo>();
|
||||
|
||||
foreach (var score in scores)
|
||||
foreach (var score in migration.NewRealm.All<ScoreInfo>())
|
||||
{
|
||||
if (score.IsLegacyScore)
|
||||
if (score.IsLegacyScore && score.Ruleset.IsLegacyRuleset())
|
||||
{
|
||||
score.LegacyTotalScore = score.TotalScore;
|
||||
|
||||
// Scores with this version will trigger the update process in BackgroundBeatmapProcessor.
|
||||
// Scores with this version will trigger the score upgrade process in BackgroundBeatmapProcessor.
|
||||
score.Version = 30000002;
|
||||
|
||||
// Set a sane default while background processing runs.
|
||||
score.LegacyTotalScore = score.TotalScore;
|
||||
}
|
||||
else
|
||||
score.Version = LegacyScoreEncoder.LATEST_VERSION;
|
||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
/// <remarks>
|
||||
/// <list type="bullet">
|
||||
/// <item><description>30000001: Appends <see cref="LegacyReplaySoloScoreInfo"/> to the end of scores.</description></item>
|
||||
/// <item><description>30000002: Score stored to replay calculated using the Score V2 algorithm.</description></item>
|
||||
/// <item><description>30000002: Score stored to replay calculated using the Score V2 algorithm. Legacy scores on this version are candidate to Score V1 -> V2 conversion.</description></item>
|
||||
/// <item><description>30000003: First version after converting legacy total score to standardised.</description></item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
|
Loading…
Reference in New Issue
Block a user