Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-fetch status of any beatmaps stuck in qualified status #32455

Merged
merged 1 commit into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions osu.Game/Beatmaps/BeatmapInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ public BeatmapOnlineStatus Status
/// <summary>
/// Reset any fetched online linking information (and history).
/// </summary>
public void ResetOnlineInfo()
public void ResetOnlineInfo(bool resetOnlineId = true)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a 99.999999% confidence this will never again be called with resetOnlineId: false outside of the migration this PR is adding, and as such I would have just copied the logic across because I utterly detest boolean parameters like this that basically turn off some of the method, but I don't feel strongly enough about it to demand it changed

{
OnlineID = -1;
if (resetOnlineId)
OnlineID = -1;
LastOnlineUpdate = null;
OnlineMD5Hash = string.Empty;
if (Status != BeatmapOnlineStatus.LocallyModified)
Expand Down
12 changes: 11 additions & 1 deletion osu.Game/Database/RealmAccess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ public class RealmAccess : IDisposable
/// 45 2024-12-23 Change beat snap divisor adjust defaults to be Ctrl+Scroll instead of Ctrl+Shift+Scroll, if not already changed by user.
/// 46 2024-12-26 Change beat snap divisor bindings to match stable directionality ¯\_(ツ)_/¯.
/// 47 2025-01-21 Remove right mouse button binding for absolute scroll. Never use mouse buttons (or scroll) for global actions.
/// 48 2025-03-19 Clear online status for all qualified beatmaps (some were stuck in a qualified state due to local caching issues).
/// </summary>
private const int schema_version = 47;
private const int schema_version = 48;

/// <summary>
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
Expand Down Expand Up @@ -1245,6 +1246,15 @@ void remapKeyBinding(int oldAction, int newAction)

break;
}

case 48:
const int qualified = (int)BeatmapOnlineStatus.Qualified;

var beatmaps = migration.NewRealm.All<BeatmapInfo>().Where(b => b.StatusInt == qualified);

foreach (var beatmap in beatmaps)
beatmap.ResetOnlineInfo(resetOnlineId: false);
Comment on lines +1255 to +1256
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In testing this does appear to work perhaps too well because I expected this to delete the "qualified" badge from the set in song select if there is no saved user credentials (which will fail the online lookup in BackgroundDataStoreProcessor). But the badge doesn't go away because the badge uses the status of the set rather than the individual difficulties.

A new couple of weird idiosyncrasies to add to the pile I guess...

break;
}

Logger.Log($"Migration completed in {stopwatch.ElapsedMilliseconds}ms");
Expand Down
Loading