throw warning instead of error

This commit is contained in:
Pepijn van Oort 2024-05-16 10:04:48 +02:00
parent e05bb5a8f7
commit 24feeba58e

View File

@ -89,7 +89,7 @@ namespace FarmmapsKPI
TimeSpan tsTotalEstimated;
//Per default just 1 run per field. For debugging check if when we run multiple times do we get (should be) always the same output?
int nrun = 1;
int nrun = 5;
for (int run = 1; run <= nrun; run++) {
//for (int i = 0; i < fieldsInputs.Count; i++)
for (int i = 3; i < 4; i++) // for testing
@ -365,7 +365,11 @@ namespace FarmmapsKPI
int nOperationsInput = input.DataOperations.Length;
int nOperationsCropfield = crprecChildren.Count;
if (nOperationsInput != nOperationsCropfield)
throw new Exception(String.Format($"run {run}: nOperationsInput != nOperationsCropfield?!"));
{
_logger.LogWarning(String.Format($"1. run {run}: nOperationsInput != nOperationsCropfield?!"));
//throw new Exception(String.Format($"run {run}: nOperationsInput != nOperationsCropfield?!"));
}
//Check totalNfertiliser input and Cropfield
for (int o = 0; o < crprecChildren.Count; o++)
@ -374,7 +378,10 @@ namespace FarmmapsKPI
totalNferiliserCropfield = totalNferiliserCropfield + (double)data.n;
}
if (totalNferiliserInput != totalNferiliserCropfield)
throw new Exception(String.Format($"run {run}: totalNferiliserInput != totalNferiliserCropfield?!"));
{
_logger.LogWarning(String.Format($"2. run {run}: totalNferiliserInput != totalNferiliserCropfield?!"));
//throw new Exception(String.Format($"run {run}: totalNferiliserInput != totalNferiliserCropfield?!"));
}
//Now get the KPIs for this cropfield, mounted with operations & cropyield
@ -520,8 +527,13 @@ namespace FarmmapsKPI
//Check if totalNferiliserInput is equal to what comes out of the KPI calculation
//PO20240515: Hier gaat het mis!!!
if (elementName == "nFertilizerNKgHa")
{
if (totalNferiliserInput != Convert.ToDouble(elementValue))
throw new Exception(String.Format($"run {run}: totalNferiliserInput != nFertilizerNKgHa?!"));
{
_logger.LogWarning(String.Format($"3. run {run}: totalNferiliserInput != nFertilizerNKgHa"));
//throw new Exception(String.Format($"run {run}: totalNferiliserInput != nFertilizerNKgHa"));
}
}
}
}
else if (kpio.id == "B2")