1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-01-06 06:41:40 +02:00

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

This commit is contained in:
Mark McDowall 2012-01-22 20:14:01 -08:00
parent 9150574c35
commit baa0b8df67
2 changed files with 37 additions and 0 deletions

View File

@ -317,6 +317,42 @@ public void Get_Series_With_Count_Half_Ignored()
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()
{ {

View File

@ -53,6 +53,7 @@ public virtual IList<Series> GetAllSeriesWithEpisodeCount()
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);