don't write duplicate KPIOutput items to output csv
This commit is contained in:
parent
8771e47b28
commit
1a9d5af5f6
@ -83,7 +83,7 @@ namespace FarmmapsKPI
|
|||||||
private async Task Process(List<UserRoot> roots, KPIInput input, StreamWriter sw)
|
private async Task Process(List<UserRoot> roots, KPIInput input, StreamWriter sw)
|
||||||
{
|
{
|
||||||
KPIOutput kpio;
|
KPIOutput kpio;
|
||||||
KPIOutput kpioPrevious = null;
|
KPIOutput kpioPrevious = new KPIOutput(); //creates a new empty
|
||||||
|
|
||||||
string downloadFolder = input.DownloadFolder;
|
string downloadFolder = input.DownloadFolder;
|
||||||
if (string.IsNullOrEmpty(downloadFolder)) {
|
if (string.IsNullOrEmpty(downloadFolder)) {
|
||||||
@ -271,7 +271,7 @@ namespace FarmmapsKPI
|
|||||||
dataList = new List<string> { };
|
dataList = new List<string> { };
|
||||||
kpio = JsonConvert.DeserializeObject<KPIOutput>(item.Data.ToString());
|
kpio = JsonConvert.DeserializeObject<KPIOutput>(item.Data.ToString());
|
||||||
//Seems sometimes duplicate KPI items are returned. So check that here and only write if this kpio is different from previous
|
//Seems sometimes duplicate KPI items are returned. So check that here and only write if this kpio is different from previous
|
||||||
if (kpio != kpioPrevious)
|
if (kpio.id != kpioPrevious.id)
|
||||||
{
|
{
|
||||||
dataList.Add(kpio.parentName);
|
dataList.Add(kpio.parentName);
|
||||||
dataList.Add(kpio.data.area);
|
dataList.Add(kpio.data.area);
|
||||||
|
@ -90,7 +90,7 @@
|
|||||||
"name": "Kunstmest strooien",
|
"name": "Kunstmest strooien",
|
||||||
"operationCode": "7",
|
"operationCode": "7",
|
||||||
"product": "7360",
|
"product": "7360",
|
||||||
"quantity": "400",
|
"quantity": "200",
|
||||||
"status": "3",
|
"status": "3",
|
||||||
"to": "2022-05-23T12:34:00",
|
"to": "2022-05-23T12:34:00",
|
||||||
"unit": "kg/ha",
|
"unit": "kg/ha",
|
||||||
|
Loading…
Reference in New Issue
Block a user