Fixed: Sorting in Interactive search duplicates results

Closes #3964
This commit is contained in:
Mark McDowall 2021-01-15 17:24:19 -08:00
parent efb18223fe
commit a6637b2911
1 changed files with 12 additions and 5 deletions

View File

@ -151,7 +151,7 @@ namespace NzbDrone.Core.IndexerSearch
}
}
return downloadDecisions;
return DeDupeDecisions(downloadDecisions);
}
private List<SceneSeasonMapping> GetSceneSeasonMappings(Series series, List<Episode> episodes)
@ -303,7 +303,7 @@ namespace NzbDrone.Core.IndexerSearch
downloadDecisions.AddRange(decisions);
}
return downloadDecisions;
return DeDupeDecisions(downloadDecisions);
}
private List<DownloadDecision> SearchDaily(Series series, Episode episode, bool monitoredOnly, bool userInvokedSearch, bool interactiveSearch)
@ -362,7 +362,7 @@ namespace NzbDrone.Core.IndexerSearch
downloadDecisions.AddRange(SearchSingle(series, episode, monitoredOnly, userInvokedSearch, interactiveSearch));
}
return downloadDecisions;
return DeDupeDecisions(downloadDecisions);
}
private List<DownloadDecision> SearchAnimeSeason(Series series, List<Episode> episodes, bool monitoredOnly, bool userInvokedSearch, bool interactiveSearch)
@ -381,7 +381,7 @@ namespace NzbDrone.Core.IndexerSearch
downloadDecisions.AddRange(SearchAnime(series, episode, monitoredOnly, userInvokedSearch, interactiveSearch, true));
}
return downloadDecisions;
return DeDupeDecisions(downloadDecisions);
}
private List<DownloadDecision> SearchDailySeason(Series series, List<Episode> episodes, bool monitoredOnly, bool userInvokedSearch, bool interactiveSearch)
@ -412,7 +412,7 @@ namespace NzbDrone.Core.IndexerSearch
}
}
return downloadDecisions;
return DeDupeDecisions(downloadDecisions);
}
private TSpec Get<TSpec>(Series series, List<Episode> episodes, bool monitoredOnly, bool userInvokedSearch, bool interactiveSearch) where TSpec : SearchCriteriaBase, new()
@ -520,5 +520,12 @@ namespace NzbDrone.Core.IndexerSearch
return _makeDownloadDecision.GetSearchDecision(reports, criteriaBase).ToList();
}
private List<DownloadDecision> DeDupeDecisions(List<DownloadDecision> decisions)
{
// De-dupe reports by guid so duplicate results aren't returned.
return decisions.DistinctBy(d => d.RemoteEpisode.Release.Guid).ToList();
}
}
}