Fixed bug in history check.

This commit is contained in:
kay.one 2011-06-05 12:15:46 -07:00
parent 54d1d5e379
commit 4c8b1d9604
2 changed files with 5 additions and 3 deletions

View File

@ -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]

View File

@ -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();
} }