UpcomingProvider now gets Series in call for episodes.
This commit is contained in:
parent
b084a3bc46
commit
86ab26e2d9
|
@ -20,8 +20,10 @@ namespace NzbDrone.Core.Providers
|
||||||
|
|
||||||
public virtual UpcomingEpisodesModel Upcoming()
|
public virtual UpcomingEpisodesModel Upcoming()
|
||||||
{
|
{
|
||||||
var allEps = _database.Fetch<Episode>("WHERE AirDate BETWEEN @0 AND @1", DateTime.Today.AddDays(-1),
|
var allEps = _database.Fetch<Episode, Series>(@"SELECT * FROM Episodes
|
||||||
DateTime.Today.AddDays(8));
|
INNER JOIN Series ON Episodes.SeriesId = Series.SeriesId
|
||||||
|
WHERE AirDate BETWEEN @0 AND @1",
|
||||||
|
DateTime.Today.AddDays(-1), DateTime.Today.AddDays(8));
|
||||||
|
|
||||||
var yesterday = allEps.Where(e => e.AirDate == DateTime.Today.AddDays(-1)).ToList();
|
var yesterday = allEps.Where(e => e.AirDate == DateTime.Today.AddDays(-1)).ToList();
|
||||||
var today = allEps.Where(e => e.AirDate == DateTime.Today).ToList();
|
var today = allEps.Where(e => e.AirDate == DateTime.Today).ToList();
|
||||||
|
@ -32,22 +34,30 @@ namespace NzbDrone.Core.Providers
|
||||||
|
|
||||||
public virtual List<Episode> Yesterday()
|
public virtual List<Episode> Yesterday()
|
||||||
{
|
{
|
||||||
return _database.Fetch<Episode>("WHERE AirDate = @0", DateTime.Today.AddDays(-1));
|
return _database.Fetch<Episode, Series>(@"SELECT * FROM Episodes
|
||||||
|
INNER JOIN Series ON Episodes.SeriesId = Series.SeriesId
|
||||||
|
WHERE AirDate = @0", DateTime.Today.AddDays(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual List<Episode> Today()
|
public virtual List<Episode> Today()
|
||||||
{
|
{
|
||||||
return _database.Fetch<Episode>("WHERE AirDate = @0", DateTime.Today);
|
return _database.Fetch<Episode, Series>(@"SELECT * FROM Episodes
|
||||||
|
INNER JOIN Series ON Episodes.SeriesId = Series.SeriesId
|
||||||
|
WHERE AirDate = @0", DateTime.Today);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual List<Episode> Tomorrow()
|
public virtual List<Episode> Tomorrow()
|
||||||
{
|
{
|
||||||
return _database.Fetch<Episode>("WHERE AirDate = @0", DateTime.Today.AddDays(1));
|
return _database.Fetch<Episode, Series>(@"SELECT * FROM Episodes
|
||||||
|
INNER JOIN Series ON Episodes.SeriesId = Series.SeriesId
|
||||||
|
WHERE AirDate = @0", DateTime.Today.AddDays(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual List<Episode> Week()
|
public virtual List<Episode> Week()
|
||||||
{
|
{
|
||||||
return _database.Fetch<Episode>("WHERE AirDate BETWEEN @0 AND @1", DateTime.Today.AddDays(2), DateTime.Today.AddDays(8));
|
return _database.Fetch<Episode, Series>(@"SELECT * FROM Episodes
|
||||||
|
INNER JOIN Series ON Episodes.SeriesId = Series.SeriesId
|
||||||
|
WHERE AirDate BETWEEN @0 AND @1", DateTime.Today.AddDays(2), DateTime.Today.AddDays(8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -32,7 +32,7 @@ namespace NzbDrone.Core.Repository
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public DateTime? GrabDate { get; set; }
|
public DateTime? GrabDate { get; set; }
|
||||||
|
|
||||||
[Ignore]
|
[ResultColumn]
|
||||||
public EpisodeStatusType Status
|
public EpisodeStatusType Status
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -30,25 +30,17 @@ namespace NzbDrone.Web.Controllers
|
||||||
[GridAction]
|
[GridAction]
|
||||||
public ActionResult _AjaxBindingYesterday()
|
public ActionResult _AjaxBindingYesterday()
|
||||||
{
|
{
|
||||||
var upcomingDb = _upcomingEpisodesProvider.Yesterday();
|
var upcoming = _upcomingEpisodesProvider.Yesterday().Select(u => new UpcomingEpisodeModel
|
||||||
var upcoming = new List<UpcomingEpisodeModel>();
|
|
||||||
|
|
||||||
foreach (var item in upcomingDb)
|
|
||||||
{
|
{
|
||||||
var series = _seriesProvider.GetSeries(item.SeriesId);
|
SeriesId = u.Series.SeriesId,
|
||||||
|
EpisodeId = u.EpisodeId,
|
||||||
upcoming.Add(new UpcomingEpisodeModel
|
SeriesName = u.Series.Title,
|
||||||
{
|
SeasonNumber = u.SeasonNumber,
|
||||||
SeriesId = series.SeriesId,
|
EpisodeNumber = u.EpisodeNumber,
|
||||||
EpisodeId = item.EpisodeId,
|
Title = u.Title,
|
||||||
SeriesName = series.Title,
|
Overview = u.Overview,
|
||||||
SeasonNumber = item.SeasonNumber,
|
AirDate = u.AirDate.Add(Convert.ToDateTime(u.Series.AirTimes).TimeOfDay)
|
||||||
EpisodeNumber = item.EpisodeNumber,
|
});
|
||||||
Title = item.Title,
|
|
||||||
Overview = item.Overview,
|
|
||||||
AirDate = item.AirDate.Add(Convert.ToDateTime(series.AirTimes).TimeOfDay)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return View(new GridModel(upcoming));
|
return View(new GridModel(upcoming));
|
||||||
}
|
}
|
||||||
|
@ -56,25 +48,17 @@ namespace NzbDrone.Web.Controllers
|
||||||
[GridAction]
|
[GridAction]
|
||||||
public ActionResult _AjaxBindingToday()
|
public ActionResult _AjaxBindingToday()
|
||||||
{
|
{
|
||||||
var upcomingDb = _upcomingEpisodesProvider.Today();
|
var upcoming = _upcomingEpisodesProvider.Today().Select(u => new UpcomingEpisodeModel
|
||||||
var upcoming = new List<UpcomingEpisodeModel>();
|
|
||||||
|
|
||||||
foreach (var item in upcomingDb)
|
|
||||||
{
|
{
|
||||||
var series = _seriesProvider.GetSeries(item.SeriesId);
|
SeriesId = u.Series.SeriesId,
|
||||||
|
EpisodeId = u.EpisodeId,
|
||||||
upcoming.Add(new UpcomingEpisodeModel
|
SeriesName = u.Series.Title,
|
||||||
{
|
SeasonNumber = u.SeasonNumber,
|
||||||
SeriesId = series.SeriesId,
|
EpisodeNumber = u.EpisodeNumber,
|
||||||
EpisodeId = item.EpisodeId,
|
Title = u.Title,
|
||||||
SeriesName = series.Title,
|
Overview = u.Overview,
|
||||||
SeasonNumber = item.SeasonNumber,
|
AirDate = u.AirDate.Add(Convert.ToDateTime(u.Series.AirTimes).TimeOfDay)
|
||||||
EpisodeNumber = item.EpisodeNumber,
|
});
|
||||||
Title = item.Title,
|
|
||||||
Overview = item.Overview,
|
|
||||||
AirDate = item.AirDate.Add(Convert.ToDateTime(series.AirTimes).TimeOfDay)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return View(new GridModel(upcoming));
|
return View(new GridModel(upcoming));
|
||||||
}
|
}
|
||||||
|
@ -82,25 +66,17 @@ namespace NzbDrone.Web.Controllers
|
||||||
[GridAction]
|
[GridAction]
|
||||||
public ActionResult _AjaxBindingTomorrow()
|
public ActionResult _AjaxBindingTomorrow()
|
||||||
{
|
{
|
||||||
var upcomingDb = _upcomingEpisodesProvider.Tomorrow();
|
var upcoming = _upcomingEpisodesProvider.Tomorrow().Select(u => new UpcomingEpisodeModel
|
||||||
var upcoming = new List<UpcomingEpisodeModel>();
|
|
||||||
|
|
||||||
foreach (var item in upcomingDb)
|
|
||||||
{
|
{
|
||||||
var series = _seriesProvider.GetSeries(item.SeriesId);
|
SeriesId = u.Series.SeriesId,
|
||||||
|
EpisodeId = u.EpisodeId,
|
||||||
upcoming.Add(new UpcomingEpisodeModel
|
SeriesName = u.Series.Title,
|
||||||
{
|
SeasonNumber = u.SeasonNumber,
|
||||||
SeriesId = series.SeriesId,
|
EpisodeNumber = u.EpisodeNumber,
|
||||||
EpisodeId = item.EpisodeId,
|
Title = u.Title,
|
||||||
SeriesName = series.Title,
|
Overview = u.Overview,
|
||||||
SeasonNumber = item.SeasonNumber,
|
AirDate = u.AirDate.Add(Convert.ToDateTime(u.Series.AirTimes).TimeOfDay)
|
||||||
EpisodeNumber = item.EpisodeNumber,
|
});
|
||||||
Title = item.Title,
|
|
||||||
Overview = item.Overview,
|
|
||||||
AirDate = item.AirDate.Add(Convert.ToDateTime(series.AirTimes).TimeOfDay)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return View(new GridModel(upcoming));
|
return View(new GridModel(upcoming));
|
||||||
}
|
}
|
||||||
|
@ -108,25 +84,17 @@ namespace NzbDrone.Web.Controllers
|
||||||
[GridAction]
|
[GridAction]
|
||||||
public ActionResult _AjaxBindingWeek()
|
public ActionResult _AjaxBindingWeek()
|
||||||
{
|
{
|
||||||
var upcomingDb = _upcomingEpisodesProvider.Week();
|
var upcoming = _upcomingEpisodesProvider.Week().Select(u => new UpcomingEpisodeModel
|
||||||
var upcoming = new List<UpcomingEpisodeModel>();
|
|
||||||
|
|
||||||
foreach (var item in upcomingDb)
|
|
||||||
{
|
{
|
||||||
var series = _seriesProvider.GetSeries(item.SeriesId);
|
SeriesId = u.Series.SeriesId,
|
||||||
|
EpisodeId = u.EpisodeId,
|
||||||
upcoming.Add(new UpcomingEpisodeModel
|
SeriesName = u.Series.Title,
|
||||||
{
|
SeasonNumber = u.SeasonNumber,
|
||||||
SeriesId = series.SeriesId,
|
EpisodeNumber = u.EpisodeNumber,
|
||||||
EpisodeId = item.EpisodeId,
|
Title = u.Title,
|
||||||
SeriesName = series.Title,
|
Overview = u.Overview,
|
||||||
SeasonNumber = item.SeasonNumber,
|
AirDate = u.AirDate.Add(Convert.ToDateTime(u.Series.AirTimes).TimeOfDay)
|
||||||
EpisodeNumber = item.EpisodeNumber,
|
});
|
||||||
Title = item.Title,
|
|
||||||
Overview = item.Overview,
|
|
||||||
AirDate = item.AirDate.Add(Convert.ToDateTime(series.AirTimes).TimeOfDay)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return View(new GridModel(upcoming));
|
return View(new GridModel(upcoming));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue