Remove cancelled layers from processors

This commit is contained in:
Michał Zieliński
2025-05-29 11:48:07 +02:00
parent d4044aa7b3
commit 72c6ff73ac
11 changed files with 28 additions and 26 deletions

View File

@@ -15,13 +15,14 @@ public class T5LastValuesProcessor(
var month = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Month")?.Desc1!);
var sourceLayer = processWorker.Records?.SingleOrDefault(x => x.Code == "SourceLayer")?.Desc1;
if (sourceLayer == null) throw new Exception("SourceLayer record not found");
var sourceImportWorker = db.Layers.SingleOrDefault(x => x.Name == sourceLayer);
var sourceImportWorker = db.Layers.SingleOrDefault(x => x.Name == sourceLayer && !x.IsDeleted && !x.IsCancelled);
if (sourceImportWorker == null) throw new Exception("SourceImportWorker layer not found");
var source = processWorker.Records?.SingleOrDefault(x => x.Code == "Source")?.Desc1;
if (sourceLayer == null) throw new Exception("Source record not found");
var processedLayer = db.Layers
.Where(x => x.ParentId == processWorker.Id)
.Where(x => x.ParentId == processWorker.Id
&& !x.IsDeleted && !x.IsCancelled)
.OrderByDescending(x => x.CreatedAt)
.FirstOrDefault();
@@ -51,7 +52,7 @@ public class T5LastValuesProcessor(
var dataSources = db.Layers
.Include(x => x.Records)
.Where(x => x.ParentId == sourceImportWorker.Id
&& !x.IsDeleted)
&& !x.IsDeleted && !x.IsCancelled)
.OrderByDescending(x => x.CreatedAt)
.AsNoTracking()
.ToList();