mirror of https://github.com/ppy/osu
Fix online replays not being available locally
This commit is contained in:
parent
c92332d2e4
commit
946a202ee5
|
@ -158,7 +158,9 @@ private void validateOnlineIds(BeatmapSetInfo beatmapSet)
|
|||
void resetIds() => beatmapSet.Beatmaps.ForEach(b => b.OnlineBeatmapID = null);
|
||||
}
|
||||
|
||||
protected override bool CheckLocalAvailability(BeatmapSetInfo model, IQueryable<BeatmapSetInfo> items) => items.Any(b => b.OnlineBeatmapSetID == model.OnlineBeatmapSetID);
|
||||
protected override bool CheckLocalAvailability(BeatmapSetInfo model, IQueryable<BeatmapSetInfo> items)
|
||||
=> base.CheckLocalAvailability(model, items)
|
||||
|| (model.OnlineBeatmapSetID != null && items.Any(b => b.OnlineBeatmapSetID == model.OnlineBeatmapSetID));
|
||||
|
||||
/// <summary>
|
||||
/// Delete a beatmap difficulty.
|
||||
|
|
|
@ -33,7 +33,8 @@ public abstract class DownloadableArchiveModelManager<TModel, TFileModel> : Arch
|
|||
|
||||
private readonly MutableDatabaseBackedStoreWithFileIncludes<TModel, TFileModel> modelStore;
|
||||
|
||||
protected DownloadableArchiveModelManager(Storage storage, IDatabaseContextFactory contextFactory, IAPIProvider api, MutableDatabaseBackedStoreWithFileIncludes<TModel, TFileModel> modelStore, IIpcHost importHost = null)
|
||||
protected DownloadableArchiveModelManager(Storage storage, IDatabaseContextFactory contextFactory, IAPIProvider api, MutableDatabaseBackedStoreWithFileIncludes<TModel, TFileModel> modelStore,
|
||||
IIpcHost importHost = null)
|
||||
: base(storage, contextFactory, modelStore, importHost)
|
||||
{
|
||||
this.api = api;
|
||||
|
@ -124,7 +125,8 @@ void triggerFailure(Exception error)
|
|||
/// <param name="model">The <typeparamref name="TModel"/> whose existence needs to be checked.</param>
|
||||
/// <param name="items">The usable items present in the store.</param>
|
||||
/// <returns>Whether the <typeparamref name="TModel"/> exists.</returns>
|
||||
protected abstract bool CheckLocalAvailability(TModel model, IQueryable<TModel> items);
|
||||
protected virtual bool CheckLocalAvailability(TModel model, IQueryable<TModel> items)
|
||||
=> model.ID > 0 && items.Any(i => i.ID == model.ID && i.Files.Any());
|
||||
|
||||
public ArchiveDownloadRequest<TModel> GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Model.Equals(model));
|
||||
|
||||
|
|
|
@ -69,6 +69,8 @@ protected override IEnumerable<string> GetStableImportPaths(Storage stableStorag
|
|||
|
||||
protected override ArchiveDownloadRequest<ScoreInfo> CreateDownloadRequest(ScoreInfo score, bool minimiseDownload) => new DownloadReplayRequest(score);
|
||||
|
||||
protected override bool CheckLocalAvailability(ScoreInfo model, IQueryable<ScoreInfo> items) => items.Any(s => s.Equals(model) && s.Files.Any());
|
||||
protected override bool CheckLocalAvailability(ScoreInfo model, IQueryable<ScoreInfo> items)
|
||||
=> base.CheckLocalAvailability(model, items)
|
||||
|| (model.OnlineScoreID != null && items.Any(i => i.OnlineScoreID == model.OnlineScoreID));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue