1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-25 01:06:30 +00: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 @@ namespace NzbDrone.Core.Test.ProviderTests
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]
public void Get_Single_Series()
{

View file

@ -53,6 +53,7 @@ namespace NzbDrone.Core.Providers
FROM Series
INNER JOIN QualityProfiles ON Series.QualityProfileId = QualityProfiles.QualityProfileId
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,
Series.Language, Series.Path, Series.Monitored, Series.QualityProfileId, Series.SeasonFolder,
QualityProfiles.QualityProfileId, QualityProfiles.Name, QualityProfiles.Cutoff, QualityProfiles.SonicAllowed", DateTime.Today);