From 58e0b19d06410b9b7fee318e74e2cad62c011dc2 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Wed, 6 Sep 2023 08:06:51 +0300 Subject: [PATCH] Include indexer flags to show the correct custom formats in movie imported history --- src/NzbDrone.Core/History/HistoryService.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/NzbDrone.Core/History/HistoryService.cs b/src/NzbDrone.Core/History/HistoryService.cs index 3176e4dfb..74ebaef71 100644 --- a/src/NzbDrone.Core/History/HistoryService.cs +++ b/src/NzbDrone.Core/History/HistoryService.cs @@ -87,9 +87,8 @@ namespace NzbDrone.Core.History public QualityModel GetBestQualityInHistory(QualityProfile profile, int movieId) { var comparer = new QualityModelComparer(profile); - return _historyRepository.GetBestQualityInHistory(movieId) - .OrderByDescending(q => q, comparer) - .FirstOrDefault(); + + return _historyRepository.GetBestQualityInHistory(movieId).MaxBy(q => q, comparer); } public void UpdateMany(List toUpdate) @@ -163,9 +162,7 @@ namespace NzbDrone.Core.History history.Data.Add("ReleaseHash", message.Movie.ParsedMovieInfo.ReleaseHash); } - var torrentRelease = message.Movie.Release as TorrentInfo; - - if (torrentRelease != null) + if (message.Movie.Release is TorrentInfo torrentRelease) { history.Data.Add("TorrentInfoHash", torrentRelease.InfoHash); } @@ -206,6 +203,7 @@ namespace NzbDrone.Core.History history.Data.Add("DownloadClientName", message.DownloadClientInfo?.Name); history.Data.Add("ReleaseGroup", message.MovieInfo.ReleaseGroup); history.Data.Add("CustomFormatScore", message.MovieInfo.CustomFormatScore.ToString()); + history.Data.Add("IndexerFlags", message.ImportedMovie.IndexerFlags.ToString()); _historyRepository.Insert(history); }