Fixed: (Core) Use MinBy and MaxBy

pull/1593/head
Bogdan 1 year ago
parent e5ccbaaf24
commit a184bb0784

@ -478,8 +478,7 @@ namespace NzbDrone.Common.Disk
return mounts.Where(drive => drive.RootDirectory.PathEquals(path) ||
drive.RootDirectory.IsParentPath(path))
.OrderByDescending(drive => drive.RootDirectory.Length)
.FirstOrDefault();
.MaxBy(drive => drive.RootDirectory.Length);
}
catch (Exception ex)
{

@ -31,9 +31,7 @@ namespace NzbDrone.Core.History
public History MostRecentForDownloadId(string downloadId)
{
return FindByDownloadId(downloadId)
.OrderByDescending(h => h.Date)
.FirstOrDefault();
return FindByDownloadId(downloadId).MaxBy(h => h.Date);
}
public List<History> FindByDownloadId(string downloadId)
@ -75,9 +73,7 @@ namespace NzbDrone.Core.History
public History MostRecentForIndexer(int indexerId)
{
return Query(x => x.IndexerId == indexerId)
.OrderByDescending(h => h.Date)
.FirstOrDefault();
return Query(x => x.IndexerId == indexerId).MaxBy(h => h.Date);
}
public List<History> Between(DateTime start, DateTime end)

Loading…
Cancel
Save