diff --git a/WebAPI/Controllers/LayersController.cs b/WebAPI/Controllers/LayersController.cs index 742364a..d06548a 100644 --- a/WebAPI/Controllers/LayersController.cs +++ b/WebAPI/Controllers/LayersController.cs @@ -368,7 +368,10 @@ namespace WebAPI.Controllers } internal void ProcessLayer(Layer processWorker, bool alwaysProcess = false) { - + if (googleSheetValues == null) + { + throw new Exception("Google Sheets API not initialized"); + } string? name = processWorker.Name; string? year = processWorker?.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1; if (year == null) @@ -376,19 +379,6 @@ namespace WebAPI.Controllers throw new Exception("Year record nod found"); } - if (!alwaysProcess && int.Parse(year!) < DateTime.UtcNow.Year) - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker!.Name}, {processWorker.Id}", - Type = LogEntryType.warning, - LogType = LogType.process, - Message = "processLayer is out of date. Should be disabled. Not processed.", - CreatedAt = DateTime.UtcNow - }); - return; - } - string? processType = processWorker?.Records?.SingleOrDefault(x => x.Code == "ProcessType")?.Desc1; if (processType == null) { @@ -396,18 +386,6 @@ namespace WebAPI.Controllers } if (processType == "T3-SourceYearSummary") { - if (!alwaysProcess && int.Parse(year!) < DateTime.UtcNow.Year) - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker!.Name}, {processWorker.Id}", - Type = LogEntryType.warning, - LogType = LogType.process, - Message = "processLayer is out of date. Should be disabled. Not processed", - CreatedAt = DateTime.UtcNow - }); - return; - } T3SourceYearSummaryProcessor processor = new T3SourceYearSummaryProcessor(db, googleSheetValues, this); processor.process(processWorker!); @@ -423,18 +401,6 @@ namespace WebAPI.Controllers } if (processType == "T3-MultiSourceYearSummary") { - if (!alwaysProcess && int.Parse(year!) < DateTime.UtcNow.Year) - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker!.Name}, {processWorker.Id}", - Type = LogEntryType.warning, - LogType = LogType.process, - Message = "processLayer is out of date. Should be disabled. Not processed", - CreatedAt = DateTime.UtcNow - }); - return; - } T3MultiSourceYearSummaryProcessor processor = new T3MultiSourceYearSummaryProcessor(db, googleSheetValues, this); processor.process(processWorker!); @@ -453,18 +419,6 @@ namespace WebAPI.Controllers { throw new Exception("Month record not found"); } - if (!alwaysProcess && int.Parse(month!) < DateTime.UtcNow.Month) - { - logsController.AddEntry(new LogEntry - { - Title = $"{processWorker!.Name}, {processWorker.Id}", - Type = LogEntryType.warning, - LogType = LogType.process, - Message = "processLayer is out of date. Should be disabled. Not processed", - CreatedAt = DateTime.UtcNow - }); - return; - } switch (processType!) { case "T3-SingleSource":