From a41b5471770c5c31c55f5ffcc4abc8110f8cb8f6 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Mon, 1 Oct 2018 11:49:46 -0500 Subject: [PATCH] serve discontinuedDate as updatedDate if exists closes #528 closes #522 related to #427 --- .../MappingProfiles/FilterListDtoMappingProfile.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/FilterLists.Services/FilterList/MappingProfiles/FilterListDtoMappingProfile.cs b/src/FilterLists.Services/FilterList/MappingProfiles/FilterListDtoMappingProfile.cs index 16ed13838..604423be8 100644 --- a/src/FilterLists.Services/FilterList/MappingProfiles/FilterListDtoMappingProfile.cs +++ b/src/FilterLists.Services/FilterList/MappingProfiles/FilterListDtoMappingProfile.cs @@ -40,14 +40,15 @@ public FilterListDtoMappingProfile() => .Select(lt => (int)lt.TagId))) .ForMember(dest => dest.UpdatedDate, opt => opt.MapFrom(src => - src.Snapshots - .Count(s => s.WasSuccessful && s.WasUpdated) >= 2 + src.DiscontinuedDate ?? + (src.Snapshots + .Count(s => s.WasSuccessful && s.WasUpdated) >= 2 ? src.Snapshots .Where(s => s.WasSuccessful && s.WasUpdated) .Select(s => s.CreatedDateUtc) .OrderByDescending(c => c) .FirstOrDefault() - : null)) + : null))) .ForMember(dest => dest.ViewUrlMirrors, opt => opt.MapFrom(src => src.ViewUrlMirror1 != null