Fixed: api/v3/history/series "includeSeries" and "includeEpisode" query parameters

Closes #4727
This commit is contained in:
Mark McDowall 2021-11-03 17:21:03 -07:00
parent 19510c4932
commit b70ef368db
1 changed files with 8 additions and 4 deletions

View File

@ -58,7 +58,9 @@ namespace NzbDrone.Core.History
public List<EpisodeHistory> GetBySeries(int seriesId, EpisodeHistoryEventType? eventType)
{
var query = Query.Where(h => h.SeriesId == seriesId);
var query = Query.Join<EpisodeHistory, Series>(JoinType.Inner, h => h.Series, (h, s) => h.SeriesId == s.Id)
.Join<EpisodeHistory, Episode>(JoinType.Inner, h => h.Episode, (h, e) => h.EpisodeId == e.Id)
.Where(h => h.SeriesId == seriesId);
if (eventType.HasValue)
{
@ -70,9 +72,11 @@ namespace NzbDrone.Core.History
public List<EpisodeHistory> GetBySeason(int seriesId, int seasonNumber, EpisodeHistoryEventType? eventType)
{
var query = Query.Join<EpisodeHistory, Episode>(JoinType.Inner, h => h.Episode, (h, e) => h.EpisodeId == e.Id)
.Where(h => h.SeriesId == seriesId)
.AndWhere(h => h.Episode.SeasonNumber == seasonNumber);
SortBuilder<EpisodeHistory> query = Query
.Join<EpisodeHistory, Episode>(JoinType.Inner, h => h.Episode, (h, e) => h.EpisodeId == e.Id)
.Join<EpisodeHistory, Series>(JoinType.Inner, h => h.Series, (h, s) => h.SeriesId == s.Id)
.Where(h => h.SeriesId == seriesId)
.AndWhere(h => h.Episode.SeasonNumber == seasonNumber);
if (eventType.HasValue)
{