Replace existing cases with new helper method

This commit is contained in:
Dean Herbert
2021-11-19 22:13:07 +09:00
parent eecf6ad558
commit 83b4625bd5
6 changed files with 10 additions and 10 deletions

View File

@ -516,7 +516,7 @@ namespace osu.Game.Database
{
Files.Dereference(file.FileInfo);
if (file.ID > 0)
if (file.IsManaged)
{
// This shouldn't be required, but here for safety in case the provided TModel is not being change tracked
// Definitely can be removed once we rework the database backend.
@ -545,7 +545,7 @@ namespace osu.Game.Database
});
}
if (model.ID > 0)
if (model.IsManaged)
Update(model);
}
@ -811,7 +811,7 @@ namespace osu.Game.Database
/// <param name="items">The usable items present in the store.</param>
/// <returns>Whether the <typeparamref name="TModel"/> exists.</returns>
protected virtual bool CheckLocalAvailability(TModel model, IQueryable<TModel> items)
=> model.ID > 0 && items.Any(i => i.ID == model.ID && i.Files.Any());
=> model.IsManaged && items.Any(i => i.ID == model.ID && i.Files.Any());
/// <summary>
/// Whether import can be skipped after finding an existing import early in the process.