Series Grid won't show series that haven't been completely added (LastInfoSync is null).

pull/4/head
Mark McDowall 13 years ago
parent 9150574c35
commit baa0b8df67

@ -317,6 +317,42 @@ namespace NzbDrone.Core.Test.ProviderTests
Assert.AreEqual(5, series[0].EpisodeFileCount); Assert.AreEqual(5, series[0].EpisodeFileCount);
} }
[Test]
public void Get_Series_should_not_return_series_that_do_not_have_info_synced_yet()
{
WithRealDb();
var fakeQuality = Builder<QualityProfile>.CreateNew().Build();
var fakeSeries = Builder<Series>.CreateListOfSize(5)
.All()
.With(e => e.QualityProfileId = fakeQuality.QualityProfileId)
.TheLast(2)
.With(e => e.LastInfoSync = null)
.Build();
var fakeEpisodes = Builder<Episode>.CreateListOfSize(10)
.All()
.With(e => e.SeriesId = fakeSeries.First().SeriesId)
.With(e => e.AirDate = DateTime.Today.AddDays(-1))
.TheFirst(5)
.With(e => e.Ignored = false)
.TheLast(5)
.With(e => e.Ignored = true)
.Build();
Db.InsertMany(fakeSeries);
Db.Insert(fakeQuality);
Db.InsertMany(fakeEpisodes);
//Act
Mocker.Resolve<QualityProvider>();
var series = Mocker.Resolve<SeriesProvider>().GetAllSeriesWithEpisodeCount();
//Assert
series.Should().HaveCount(3);
}
[Test] [Test]
public void Get_Single_Series() public void Get_Single_Series()
{ {

@ -53,6 +53,7 @@ namespace NzbDrone.Core.Providers
FROM Series FROM Series
INNER JOIN QualityProfiles ON Series.QualityProfileId = QualityProfiles.QualityProfileId INNER JOIN QualityProfiles ON Series.QualityProfileId = QualityProfiles.QualityProfileId
LEFT JOIN Episodes ON Series.SeriesId = Episodes.SeriesId LEFT JOIN Episodes ON Series.SeriesId = Episodes.SeriesId
WHERE Series.LastInfoSync IS NOT NULL
GROUP BY Series.SeriesId, Series.Title, Series.CleanTitle, Series.Status, Series.Overview, Series.AirsDayOfWeek,Series.AirTimes, GROUP BY Series.SeriesId, Series.Title, Series.CleanTitle, Series.Status, Series.Overview, Series.AirsDayOfWeek,Series.AirTimes,
Series.Language, Series.Path, Series.Monitored, Series.QualityProfileId, Series.SeasonFolder, Series.Language, Series.Path, Series.Monitored, Series.QualityProfileId, Series.SeasonFolder,
QualityProfiles.QualityProfileId, QualityProfiles.Name, QualityProfiles.Cutoff, QualityProfiles.SonicAllowed", DateTime.Today); QualityProfiles.QualityProfileId, QualityProfiles.Name, QualityProfiles.Cutoff, QualityProfiles.SonicAllowed", DateTime.Today);

Loading…
Cancel
Save