specify how many seconds to wait for the KPItask to be completed

This commit is contained in:
2023-11-15 16:49:46 +01:00
parent aa18393102
commit 3f66676914
2 changed files with 10 additions and 6 deletions

View File

@@ -85,8 +85,9 @@ namespace FarmmapsKPI
TimeSpan tsTotalEstimated;
for (int i = 0; i < fieldsInputs.Count; i++)
{
watch.Restart();
//for (int i = 7; i < 8; i++)
{
watch.Restart();
input = fieldsInputs[i];
_logger.LogInformation(string.Format($"// FarmmapsKPI: Downloading KPI's for field {i + 1} out of {fieldsInputs.Count} to single csv file {KPIItemPathCsv}"));
try
@@ -262,7 +263,7 @@ namespace FarmmapsKPI
if (data.area != area_ha)
{
double differencePercent = 100.0*(Convert.ToDouble(area_ha) / Convert.ToDouble(data.area) - 1.0);
_logger.LogWarning($"cropfield has area {area_ha}, but operation has area {data.area}" +
_logger.LogWarning($"cropfield has area {area_ha}, but in your KPIinput.json or file like that, you have an operation with area {data.area}" +
$" Difference is {area_ha} / {data.area} - 100% = {differencePercent}%." +
$" Is that correct? Example if operation was applied in part of field, e.g. in case of variable rate (VRA) application." +
$" Or did you accidentally fill in area in the KPIinput json? To use cropfield area, omit field 'area' from json" +
@@ -311,7 +312,7 @@ namespace FarmmapsKPI
//Now get the KPIs for this cropfield, mounted with operations & cropyield
// Get KPI data for saving it in a file, here the generalsedrvice is called to get the KPI data
_logger.LogInformation($"GetKpiItemsForCropField('{cropfieldItem.Code}')");
KPIItems = await _generalService.GetKpiItemsForCropField(cropfieldItem);
KPIItems = await _generalService.GetKpiItemsForCropField(cropfieldItem, 60);
_logger.LogInformation($"Found {KPIItems.Count} KPI items");
//Download KPI's into a json output file for this specific cropfield (with unique cropfieldItem.Code)