Update LayersController.cs
This commit is contained in:
@@ -368,7 +368,10 @@ namespace WebAPI.Controllers
|
|||||||
}
|
}
|
||||||
internal void ProcessLayer(Layer processWorker, bool alwaysProcess = false)
|
internal void ProcessLayer(Layer processWorker, bool alwaysProcess = false)
|
||||||
{
|
{
|
||||||
|
if (googleSheetValues == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Google Sheets API not initialized");
|
||||||
|
}
|
||||||
string? name = processWorker.Name;
|
string? name = processWorker.Name;
|
||||||
string? year = processWorker?.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1;
|
string? year = processWorker?.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1;
|
||||||
if (year == null)
|
if (year == null)
|
||||||
@@ -376,19 +379,6 @@ namespace WebAPI.Controllers
|
|||||||
throw new Exception("Year record nod found");
|
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;
|
string? processType = processWorker?.Records?.SingleOrDefault(x => x.Code == "ProcessType")?.Desc1;
|
||||||
if (processType == null)
|
if (processType == null)
|
||||||
{
|
{
|
||||||
@@ -396,18 +386,6 @@ namespace WebAPI.Controllers
|
|||||||
}
|
}
|
||||||
if (processType == "T3-SourceYearSummary")
|
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);
|
T3SourceYearSummaryProcessor processor = new T3SourceYearSummaryProcessor(db, googleSheetValues, this);
|
||||||
processor.process(processWorker!);
|
processor.process(processWorker!);
|
||||||
|
|
||||||
@@ -423,18 +401,6 @@ namespace WebAPI.Controllers
|
|||||||
}
|
}
|
||||||
if (processType == "T3-MultiSourceYearSummary")
|
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);
|
T3MultiSourceYearSummaryProcessor processor = new T3MultiSourceYearSummaryProcessor(db, googleSheetValues, this);
|
||||||
processor.process(processWorker!);
|
processor.process(processWorker!);
|
||||||
|
|
||||||
@@ -453,18 +419,6 @@ namespace WebAPI.Controllers
|
|||||||
{
|
{
|
||||||
throw new Exception("Month record not found");
|
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!)
|
switch (processType!)
|
||||||
{
|
{
|
||||||
case "T3-SingleSource":
|
case "T3-SingleSource":
|
||||||
|
|||||||
Reference in New Issue
Block a user