Fixed: History Since API endpoint

This commit is contained in:
Mark McDowall 2022-12-10 01:11:20 -08:00
parent d09e5d8eb4
commit 60470b653a
1 changed files with 10 additions and 2 deletions

View File

@ -119,14 +119,22 @@ namespace NzbDrone.Core.History
public List<EpisodeHistory> Since(DateTime date, EpisodeHistoryEventType? eventType) public List<EpisodeHistory> Since(DateTime date, EpisodeHistoryEventType? eventType)
{ {
var builder = Builder().Where<EpisodeHistory>(x => x.Date >= date); var builder = Builder()
.Join<EpisodeHistory, Series>((h, a) => h.SeriesId == a.Id)
.Join<EpisodeHistory, Episode>((h, a) => h.EpisodeId == a.Id)
.Where<EpisodeHistory>(x => x.Date >= date);
if (eventType.HasValue) if (eventType.HasValue)
{ {
builder.Where<EpisodeHistory>(h => h.EventType == eventType); builder.Where<EpisodeHistory>(h => h.EventType == eventType);
} }
return Query(builder).OrderBy(h => h.Date).ToList(); return _database.QueryJoined<EpisodeHistory, Series, Episode>(builder, (history, series, episode) =>
{
history.Series = series;
history.Episode = episode;
return history;
}).OrderBy(h => h.Date).ToList();
} }
} }
} }