diff --git a/src/FilterLists.Services/FilterList/FilterListService.cs b/src/FilterLists.Services/FilterList/FilterListService.cs index b642a0dae..8ab314849 100644 --- a/src/FilterLists.Services/FilterList/FilterListService.cs +++ b/src/FilterLists.Services/FilterList/FilterListService.cs @@ -48,15 +48,17 @@ await DbContext.Snapshots.Where(s => s.FilterListId == details.Id && s.IsComplet .CountAsync(); } - private async Task GetUpdatedDate(ListDetailsDto details) + private async Task GetUpdatedDate(ListDetailsDto details) { - return await DbContext.Snapshots.Where(s => s.FilterListId == details.Id && s.IsCompleted) - .Include(s => s.AddedSnapshotRules) - .Include(s => s.RemovedSnapshotRules) - .Where(s => s.AddedSnapshotRules.Count > 0 || s.RemovedSnapshotRules.Count > 0) - .Select(s => s.CreatedDateUtc) - .OrderByDescending(s => s.Date) - .FirstAsync(); + return details.DiscontinuedDate != null + ? (DateTime?) null + : await DbContext.Snapshots.Where(s => s.FilterListId == details.Id && s.IsCompleted) + .Include(s => s.AddedSnapshotRules) + .Include(s => s.RemovedSnapshotRules) + .Where(s => s.AddedSnapshotRules.Count > 0 || s.RemovedSnapshotRules.Count > 0) + .Select(s => s.CreatedDateUtc) + .OrderByDescending(s => s.Date) + .FirstAsync(); } } } \ No newline at end of file