From 5ac1dace7f433117bb6289f5476e962cd7abda7c Mon Sep 17 00:00:00 2001 From: Qstick Date: Tue, 24 Jan 2023 22:29:50 -0600 Subject: [PATCH] Fixed: History Since API endpoint Closes #3198 Co-Authored-By: Mark McDowall --- src/NzbDrone.Core/History/EntityHistoryRepository.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core/History/EntityHistoryRepository.cs b/src/NzbDrone.Core/History/EntityHistoryRepository.cs index 030a40e82..24d0ac4b3 100644 --- a/src/NzbDrone.Core/History/EntityHistoryRepository.cs +++ b/src/NzbDrone.Core/History/EntityHistoryRepository.cs @@ -117,14 +117,22 @@ namespace NzbDrone.Core.History public List Since(DateTime date, EntityHistoryEventType? eventType) { - var builder = Builder().Where(x => x.Date >= date); + var builder = Builder() + .Join((h, a) => h.ArtistId == a.Id) + .Join((h, a) => h.AlbumId == a.Id) + .Where(x => x.Date >= date); if (eventType.HasValue) { builder.Where(h => h.EventType == eventType); } - return Query(builder).OrderBy(h => h.Date).ToList(); + return _database.QueryJoined(builder, (history, artist, album) => + { + history.Artist = artist; + history.Album = album; + return history; + }).OrderBy(h => h.Date).ToList(); } } }