commented out the totalNfertiliserInput = totalNferiliserCropfield check
This commit is contained in:
parent
6d6b5b1b7a
commit
c2e4f9d861
@ -92,7 +92,7 @@ namespace FarmmapsKPI
|
||||
int nrun = 1;
|
||||
for (int run = 1; run <= nrun; run++) {
|
||||
for (int i = 0; i < fieldsInputs.Count; i++)
|
||||
//for (int i = 3; i < 4; i++) // for testing
|
||||
//for (int i = 6; i < 7; i++) // for testing
|
||||
{
|
||||
watch.Restart();
|
||||
input = fieldsInputs[i];
|
||||
@ -130,8 +130,8 @@ namespace FarmmapsKPI
|
||||
int targetKPIitemsCount; //if we know we should be getting 8 KPI items (A1,B1,B2,C1,D1,E1,F1,F2)
|
||||
int maxtries = 5; // but don't keep on trying forever; there is a maximum number of tries
|
||||
int trycnt;
|
||||
double totalNferiliserInput = 0;
|
||||
double totalNferiliserCropfield = 0;
|
||||
//double totalNferiliserInput = 0;
|
||||
//double totalNferiliserCropfield = 0;
|
||||
|
||||
string downloadFolder = input.DownloadFolder;
|
||||
if (string.IsNullOrEmpty(downloadFolder)) {
|
||||
@ -325,7 +325,7 @@ namespace FarmmapsKPI
|
||||
crpOperationItems.Add(crpOperationItem);
|
||||
crpOperationItemCodes.Add(crpOperationItem.Code);
|
||||
//Keep track of totalNferiliserInput
|
||||
totalNferiliserInput = totalNferiliserInput + (double)data.n;
|
||||
//totalNferiliserInput = totalNferiliserInput + (double)data.n; / this causes a problem if N content of the fertilizer is missing. As this check is no longer needed I just commented it out
|
||||
}
|
||||
_settings.OperationItemCodes = crpOperationItemCodes.ToArray();
|
||||
SaveSettings(settingsfile);
|
||||
@ -371,17 +371,17 @@ namespace FarmmapsKPI
|
||||
}
|
||||
|
||||
|
||||
//Check totalNfertiliser input and Cropfield
|
||||
for (int o = 0; o < crprecChildren.Count; o++)
|
||||
{
|
||||
dynamic data = JObject.Parse(crprecChildren[o].Data.ToString());
|
||||
totalNferiliserCropfield = totalNferiliserCropfield + (double)data.n;
|
||||
}
|
||||
if (totalNferiliserInput != totalNferiliserCropfield)
|
||||
{
|
||||
_logger.LogWarning(String.Format($"2. run {run}: totalNferiliserInput != totalNferiliserCropfield?!"));
|
||||
//throw new Exception(String.Format($"run {run}: totalNferiliserInput != totalNferiliserCropfield?!"));
|
||||
}
|
||||
//Check totalNfertiliser input and Cropfield,
|
||||
//for (int o = 0; o < crprecChildren.Count; o++)
|
||||
//{
|
||||
// dynamic data = JObject.Parse(crprecChildren[o].Data.ToString());
|
||||
// totalNferiliserCropfield = totalNferiliserCropfield + (double)data.n;
|
||||
//}
|
||||
//if (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
|
||||
List<Item> KPIItems = await _generalService.GetKpiItemsForCropField(cropfieldItem, 3);
|
||||
@ -564,15 +564,14 @@ namespace FarmmapsKPI
|
||||
sw.WriteLine(string.Join(",", dataList));
|
||||
|
||||
//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))
|
||||
{
|
||||
_logger.LogWarning(String.Format($"3. run {run}: totalNferiliserInput != nFertilizerNKgHa"));
|
||||
//throw new Exception(String.Format($"run {run}: totalNferiliserInput != nFertilizerNKgHa"));
|
||||
}
|
||||
}
|
||||
//if (elementName == "nFertilizerNKgHa")
|
||||
//{
|
||||
// if (totalNferiliserInput != Convert.ToDouble(elementValue))
|
||||
// {
|
||||
// _logger.LogWarning(String.Format($"3. run {run}: totalNferiliserInput != nFertilizerNKgHa"));
|
||||
// //throw new Exception(String.Format($"run {run}: totalNferiliserInput != nFertilizerNKgHa"));
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
else if (kpio.id == "B2")
|
||||
|
Loading…
Reference in New Issue
Block a user