Use MinBy and MaxBy instead of OrderBy + First

(cherry picked from commit 6ea3d8c127eafbcf9d1b6e9338b737e91e256875)

Closes #2323
This commit is contained in:
Stepan Goremykin
2023-04-01 16:57:19 +02:00
committed by Bogdan
parent 06baae060d
commit a4930474a5
7 changed files with 10 additions and 17 deletions
@@ -881,7 +881,7 @@ namespace NzbDrone.Core.MetadataSource.BookInfo
book.Editions = resource.Books.Select(x => MapEdition(x)).ToList();
// monitor the most popular release
var mostPopular = book.Editions.Value.OrderByDescending(x => x.Ratings.Popularity).FirstOrDefault();
var mostPopular = book.Editions.Value.MaxBy(x => x.Ratings.Popularity);
if (mostPopular != null)
{
mostPopular.Monitored = true;