1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Fixed: Rare case of null quality causing issues with manual import.

Fixes #2227
This commit is contained in:
Leonardo Galli 2018-02-02 15:01:02 +01:00
parent d5832a6a07
commit 33cc228ac1

View File

@ -49,13 +49,16 @@ public List<ImportResult> Import(List<ImportDecision> decisions, bool newDownloa
{ {
_logger.Debug("Decisions: {0}", decisions.Count); _logger.Debug("Decisions: {0}", decisions.Count);
//I added a null op for the rare case that the quality is null. TODO: find out why that would even happen in the first place.
var qualifiedImports = decisions.Where(c => c.Approved) var qualifiedImports = decisions.Where(c => c.Approved)
.GroupBy(c => c.LocalMovie.Movie.Id, (i, s) => s .GroupBy(c => c.LocalMovie.Movie.Id, (i, s) => s
.OrderByDescending(c => c.LocalMovie.Quality, new QualityModelComparer(s.First().LocalMovie.Movie.Profile)) .OrderByDescending(c => c.LocalMovie.Quality ?? new QualityModel{Quality = Quality.Unknown}, new QualityModelComparer(s.First().LocalMovie.Movie.Profile))
.ThenByDescending(c => c.LocalMovie.Size)) .ThenByDescending(c => c.LocalMovie.Size))
.SelectMany(c => c) .SelectMany(c => c)
.ToList(); .ToList();
var importResults = new List<ImportResult>(); var importResults = new List<ImportResult>();
foreach (var importDecision in qualifiedImports.OrderBy(e => e.LocalMovie.Size) foreach (var importDecision in qualifiedImports.OrderBy(e => e.LocalMovie.Size)