fix bug in GetLeastRecentlyCapturedLists()

This commit is contained in:
Collin M. Barrett 2018-02-10 19:05:23 -06:00
parent 8439a5c14c
commit c75e2700a1

View file

@ -34,16 +34,16 @@ private void RollbackIncomplete()
private async Task<IEnumerable<FilterListViewUrlDto>> GetLeastRecentlyCapturedLists(int batchSize)
{
return await dbContext.FilterLists
.OrderBy(x => x.Snapshots.Any())
.ThenBy(x => x.Snapshots
.Select(y => y.CreatedDateUtc)
.OrderByDescending(y => y)
.FirstOrDefault())
.Where(x => x.Snapshots
.Select(y => y.CreatedDateUtc)
return await dbContext.FilterLists.OrderBy(x => x.Snapshots.Any())
.ThenBy(x =>
x.Snapshots.Select(y => y.CreatedDateUtc)
.OrderByDescending(y => y)
.FirstOrDefault())
.Where(x => !x.Snapshots.Any() ||
x.Snapshots.Select(y => y.CreatedDateUtc)
.OrderByDescending(y => y)
.FirstOrDefault() < DateTime.UtcNow.AddDays(-1))
.FirstOrDefault() <
DateTime.UtcNow.AddDays(-1))
.Take(batchSize)
.AsNoTracking()
.ProjectTo<FilterListViewUrlDto>()