mirror of
https://github.com/Radarr/Radarr
synced 2025-12-20 15:24:41 +01:00
Fixed: Sorting in Interactive search duplicates results
Fixes #5760 Fixes #5765 Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com> Co-Authored-By: Taloth <Taloth@users.noreply.github.com>
This commit is contained in:
parent
539fcb91c9
commit
a1db7a8f1e
1 changed files with 12 additions and 1 deletions
|
|
@ -56,9 +56,14 @@ public List<DownloadDecision> MovieSearch(int movieId, bool userInvokedSearch, b
|
|||
|
||||
public List<DownloadDecision> MovieSearch(Movie movie, bool userInvokedSearch, bool interactiveSearch)
|
||||
{
|
||||
var downloadDecisions = new List<DownloadDecision>();
|
||||
|
||||
var searchSpec = Get<MovieSearchCriteria>(movie, userInvokedSearch, interactiveSearch);
|
||||
|
||||
return Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec);
|
||||
var decisions = Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec);
|
||||
downloadDecisions.AddRange(decisions);
|
||||
|
||||
return DeDupeDecisions(downloadDecisions);
|
||||
}
|
||||
|
||||
private TSpec Get<TSpec>(Movie movie, bool userInvokedSearch, bool interactiveSearch)
|
||||
|
|
@ -132,5 +137,11 @@ private List<DownloadDecision> Dispatch(Func<IIndexer, IEnumerable<ReleaseInfo>>
|
|||
|
||||
return _makeDownloadDecision.GetSearchDecision(reports, criteriaBase).ToList();
|
||||
}
|
||||
|
||||
private List<DownloadDecision> DeDupeDecisions(List<DownloadDecision> decisions)
|
||||
{
|
||||
// De-dupe reports by guid so duplicate results aren't returned. Pick the one with the least rejections.
|
||||
return decisions.GroupBy(d => d.RemoteMovie.Release.Guid).Select(d => d.OrderBy(v => v.Rejections.Count()).First()).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue