1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 03:42:57 +08:00

Change default values of new object counts to -1 to identify non-processed values

This commit is contained in:
Dean Herbert 2023-12-19 18:20:02 +09:00
parent 469a659938
commit f09c6b8c1b
No known key found for this signature in database
4 changed files with 22 additions and 4 deletions

View File

@ -196,7 +196,7 @@ namespace osu.Game
realmAccess.Run(r =>
{
foreach (var b in r.All<BeatmapInfo>().Where(b => b.TotalObjectCount == 0))
foreach (var b in r.All<BeatmapInfo>().Where(b => b.TotalObjectCount < 0 || b.EndTimeObjectCount < 0))
beatmapIds.Add(b.ID);
});

View File

@ -120,9 +120,9 @@ namespace osu.Game.Beatmaps
[JsonIgnore]
public bool Hidden { get; set; }
public int EndTimeObjectCount { get; set; }
public int EndTimeObjectCount { get; set; } = -1;
public int TotalObjectCount { get; set; }
public int TotalObjectCount { get; set; } = -1;
/// <summary>
/// Reset any fetched online linking information (and history).

View File

@ -59,11 +59,13 @@ namespace osu.Game.Beatmaps
/// <summary>
/// The basic star rating for this beatmap (with no mods applied).
/// Defaults to -1 (meaning not-yet-calculated).
/// </summary>
double StarRating { get; }
/// <summary>
/// The number of hitobjects in the beatmap with a distinct end time.
/// Defaults to -1 (meaning not-yet-calculated).
/// </summary>
/// <remarks>
/// Canonically, these are hitobjects are either sliders or spinners.
@ -72,6 +74,7 @@ namespace osu.Game.Beatmaps
/// <summary>
/// The total number of hitobjects in the beatmap.
/// Defaults to -1 (meaning not-yet-calculated).
/// </summary>
int TotalObjectCount { get; }
}

View File

@ -89,8 +89,9 @@ namespace osu.Game.Database
/// 35 2023-10-16 Clear key combinations of keybindings that are assigned to more than one action in a given settings section.
/// 36 2023-10-26 Add LegacyOnlineID to ScoreInfo. Move osu_scores_*_high IDs stored in OnlineID to LegacyOnlineID. Reset anomalous OnlineIDs.
/// 38 2023-12-10 Add EndTimeObjectCount and TotalObjectCount to BeatmapInfo.
/// 39 2023-12-19 Migrate any EndTimeObjectCount and TotalObjectCount values of 0 to -1 to better identify non-calculated values.
/// </summary>
private const int schema_version = 38;
private const int schema_version = 39;
/// <summary>
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
@ -1095,6 +1096,20 @@ namespace osu.Game.Database
break;
}
case 39:
foreach (var b in migration.NewRealm.All<BeatmapInfo>())
{
// Either actually no objects, or processing ran and failed.
// Reset to -1 so the next time they become zero we know that processing was attempted.
if (b.TotalObjectCount == 0 && b.EndTimeObjectCount == 0)
{
b.TotalObjectCount = -1;
b.EndTimeObjectCount = -1;
}
}
break;
}
Logger.Log($"Migration completed in {stopwatch.ElapsedMilliseconds}ms");