mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 08:03:52 +09:00
Fix incorrect playlist item <-> availability tracker logic
Results in revert to some prior logic for the tracker implementation.
This commit is contained in:
@ -96,7 +96,7 @@ namespace osu.Game.Online.Rooms
|
|||||||
|
|
||||||
// handles changes to hash that didn't occur from the import process (ie. a user editing the beatmap in the editor, somehow).
|
// handles changes to hash that didn't occur from the import process (ie. a user editing the beatmap in the editor, somehow).
|
||||||
realmSubscription?.Dispose();
|
realmSubscription?.Dispose();
|
||||||
realmSubscription = realm.RegisterForNotifications(r => QueryBeatmapForOnlinePlay(r, SelectedItem.Value.Beatmap), (items, changes, ___) =>
|
realmSubscription = realm.RegisterForNotifications(r => filteredBeatmaps(beatmap), (items, changes, ___) =>
|
||||||
{
|
{
|
||||||
if (changes == null)
|
if (changes == null)
|
||||||
return;
|
return;
|
||||||
@ -125,7 +125,7 @@ namespace osu.Game.Online.Rooms
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DownloadState.LocallyAvailable:
|
case DownloadState.LocallyAvailable:
|
||||||
bool available = QueryBeatmapForOnlinePlay(realm.Realm, beatmap).Any();
|
bool available = filteredBeatmaps(beatmap).Any();
|
||||||
|
|
||||||
availability.Value = available ? BeatmapAvailability.LocallyAvailable() : BeatmapAvailability.NotDownloaded();
|
availability.Value = available ? BeatmapAvailability.LocallyAvailable() : BeatmapAvailability.NotDownloaded();
|
||||||
|
|
||||||
@ -140,15 +140,14 @@ namespace osu.Game.Online.Rooms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
private IQueryable<BeatmapInfo> filteredBeatmaps(APIBeatmap beatmap)
|
||||||
/// Performs a query for a local <see cref="BeatmapInfo"/> matching a requested one for the purpose of online play.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="realm">The realm to query from.</param>
|
|
||||||
/// <param name="beatmap">The requested beatmap.</param>
|
|
||||||
/// <returns>A beatmap query.</returns>
|
|
||||||
public static IQueryable<BeatmapInfo> QueryBeatmapForOnlinePlay(Realm realm, IBeatmapInfo beatmap)
|
|
||||||
{
|
{
|
||||||
return realm.All<BeatmapInfo>().Filter("OnlineID == $0 && MD5Hash == $1 && BeatmapSet.DeletePending == false", beatmap.OnlineID, beatmap.MD5Hash);
|
int onlineId = beatmap.OnlineID;
|
||||||
|
string checksum = beatmap.MD5Hash;
|
||||||
|
|
||||||
|
return realm.Realm
|
||||||
|
.All<BeatmapInfo>()
|
||||||
|
.Filter("OnlineID == $0 && MD5Hash == $1 && BeatmapSet.DeletePending == false", onlineId, checksum);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
@ -97,9 +97,6 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapLookupCache beatmapLookupCache { get; set; }
|
private BeatmapLookupCache beatmapLookupCache { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private RealmAccess realm { get; set; }
|
|
||||||
|
|
||||||
protected override bool ShouldBeConsideredForInput(Drawable child) => AllowReordering || AllowDeletion || !AllowSelection || SelectedItem.Value == Model;
|
protected override bool ShouldBeConsideredForInput(Drawable child) => AllowReordering || AllowDeletion || !AllowSelection || SelectedItem.Value == Model;
|
||||||
|
|
||||||
public DrawableRoomPlaylistItem(PlaylistItem item)
|
public DrawableRoomPlaylistItem(PlaylistItem item)
|
||||||
@ -444,7 +441,7 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
Alpha = AllowShowingResults ? 1 : 0,
|
Alpha = AllowShowingResults ? 1 : 0,
|
||||||
TooltipText = "View results"
|
TooltipText = "View results"
|
||||||
},
|
},
|
||||||
OnlinePlayBeatmapAvailabilityTracker.QueryBeatmapForOnlinePlay(realm.Realm, beatmap).Any() ? Empty() : new PlaylistDownloadButton(beatmap),
|
beatmap == null ? Empty() : new PlaylistDownloadButton(beatmap),
|
||||||
editButton = new PlaylistEditButton
|
editButton = new PlaylistEditButton
|
||||||
{
|
{
|
||||||
Size = new Vector2(30, 30),
|
Size = new Vector2(30, 30),
|
||||||
|
Reference in New Issue
Block a user