From 547b76f2332ac47c83c874a1d8b7a8a5ef3cb171 Mon Sep 17 00:00:00 2001
From: Bhabesh <bhabesh.mukhopadhyay@nibio.no>
Date: Wed, 8 Jul 2020 11:01:18 +0200
Subject: [PATCH] Re-initiate JSON array for new weather stations

Initiate the JSON array before data fetch from ajax to make sure about deal with fresh new data
---
 cydiapomonella/templates/cydiapomonella/index.html | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/cydiapomonella/templates/cydiapomonella/index.html b/cydiapomonella/templates/cydiapomonella/index.html
index c3db141f..ad82159e 100644
--- a/cydiapomonella/templates/cydiapomonella/index.html
+++ b/cydiapomonella/templates/cydiapomonella/index.html
@@ -377,14 +377,13 @@
         var TM_NON_NEGATIVE = 0;
 
         var counter = undefined;
-        console.log('I hv data');
+        
         if($.trim(data))
         {
             
             for (var i=0; i<data.length; i++)
             {
                 var strStartDateDtPicker    =   JSON.stringify(getStrConvertedDate(data[i].timeMeasured)).substring(1,11);
-
                 if(strStartDateDtPicker===$('#idTxtDateInput').val())
                 {
                     counter = 0;
@@ -392,7 +391,6 @@
                  }
                 if(typeof counter      === "undefined") 
                 {
-
                     break;
                 }
                 else
@@ -527,6 +525,7 @@
                         data    :   jsonParamUrlDataHourly,
                         //async   : false,
                         success :   function (data) {
+                            resultHeatSumDailyData = []; /* Re initialize */
                             if($.trim(data))
                             {
                                 $('#idDivHeatSum').show();
-- 
GitLab