From 256d7cbeb655a644f2308fb77848aeef196e8db6 Mon Sep 17 00:00:00 2001
From: i-vall <ivallanzasca@gmail.com>
Date: Tue, 9 Jul 2019 09:41:00 +0200
Subject: [PATCH] fix: values now accurate and no longer added up

---
 src/index.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/index.js b/src/index.js
index 0c5edf1..61d8d58 100644
--- a/src/index.js
+++ b/src/index.js
@@ -93,11 +93,12 @@ async function getData(response) {
     throw new Error(errors.VENDOR_DOWN)
   }
 }
+
 function format(response) {
-  const data = response.resultatRetour.map(value => {
+  const data = response.resultatRetour.slice(1).map((value, index) => {
     return {
       time: moment(value.DateReleve, moment.ISO_8601).format('YYYY-MM-DD'),
-      load: value.ValeurIndex,
+      load: value.ValeurIndex - response.resultatRetour[index].ValeurIndex,
       type: value.TypeAgregat
     }
   })
-- 
GitLab