From 92a3a61a4d969a4684bb4e50468e0a511f8f8e0e Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Fri, 8 Jun 2018 11:21:27 -0500 Subject: [PATCH] don't provide updated date if explicit discontinued date --- .../FilterList/FilterListService.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) 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