Fixed bug in history check.

pull/2/head
kay.one 14 years ago
parent 54d1d5e379
commit 4c8b1d9604

@ -79,7 +79,8 @@ namespace NzbDrone.Core.Test
var repo = MockLib.GetEmptyRepository(); var repo = MockLib.GetEmptyRepository();
var history = Builder<History>.CreateNew().Build(); var history = Builder<History>.CreateNew()
.With(h => h.Quality = QualityTypes.Bluray720p).Build();
repo.Add(history); repo.Add(history);
mocker.SetConstant(repo); mocker.SetConstant(repo);
@ -88,6 +89,7 @@ namespace NzbDrone.Core.Test
//Assert //Assert
Assert.IsNotNull(result); Assert.IsNotNull(result);
result.QualityType.Should().Be(QualityTypes.Bluray720p);
} }
[Test] [Test]

@ -49,8 +49,8 @@ namespace NzbDrone.Core.Providers
public virtual Quality GetBestQualityInHistory(long episodeId) public virtual Quality GetBestQualityInHistory(long episodeId)
{ {
var history = AllItems().Where(c => c.EpisodeId == episodeId).Select(d => new Quality() { QualityType = d.Quality, Proper = d.IsProper }).ToList(); var history = AllItems().Where(c => c.EpisodeId == episodeId).ToList().Select(d => new Quality(d.Quality, d.IsProper));
history.Sort(); history.OrderBy(q => q);
return history.FirstOrDefault(); return history.FirstOrDefault();
} }

Loading…
Cancel
Save