1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:37:28 +08:00

use realm query

This commit is contained in:
cdwcgt 2023-09-04 16:18:14 +09:00
parent 58844092d6
commit 3decadaf51
No known key found for this signature in database
GPG Key ID: 144396D01095C3A2
2 changed files with 3 additions and 2 deletions

View File

@ -26,6 +26,7 @@ using osu.Game.Overlays.Notifications;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Skinning; using osu.Game.Skinning;
using osu.Game.Utils; using osu.Game.Utils;
using Realms;
namespace osu.Game.Beatmaps namespace osu.Game.Beatmaps
{ {
@ -284,7 +285,7 @@ namespace osu.Game.Beatmaps
/// </summary> /// </summary>
/// <param name="query">The query.</param> /// <param name="query">The query.</param>
/// <returns>The first result for the provided query, or null if no results were found.</returns> /// <returns>The first result for the provided query, or null if no results were found.</returns>
public BeatmapInfo? QueryBeatmap(Expression<Func<BeatmapInfo, bool>> query) => Realm.Run(r => r.All<BeatmapInfo>().FirstOrDefault(query)?.Detach()); public BeatmapInfo? QueryBeatmap(Expression<Func<BeatmapInfo, bool>> query) => Realm.Run(r => r.All<BeatmapInfo>().Filter($"{nameof(BeatmapInfo.BeatmapSet)}.{nameof(BeatmapSetInfo.DeletePending)} == false").FirstOrDefault(query)?.Detach());
/// <summary> /// <summary>
/// A default representation of a WorkingBeatmap to use when no beatmap is available. /// A default representation of a WorkingBeatmap to use when no beatmap is available.

View File

@ -88,7 +88,7 @@ namespace osu.Game.Beatmaps
public virtual WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo) public virtual WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo)
{ {
if (beatmapInfo?.BeatmapSet == null || beatmapInfo.BeatmapSet?.DeletePending == true) if (beatmapInfo?.BeatmapSet == null)
return DefaultBeatmap; return DefaultBeatmap;
lock (workingCache) lock (workingCache)