serve discontinuedDate as updatedDate if exists

closes #528
closes #522
related to #427
This commit is contained in:
Collin M. Barrett 2018-10-01 11:49:46 -05:00
parent 0f40519a71
commit a41b547177

View file

@ -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