From 743e29f235d0c856e2983a84cd6906271599d907 Mon Sep 17 00:00:00 2001
From: "guilhem.carron" <gcarron@grandlyon.com>
Date: Thu, 25 Nov 2021 16:11:20 +0100
Subject: [PATCH] fix(conso): Disable half hour check if fluid different from
 elec

---
 src/components/FluidChart/FluidChart.tsx | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/components/FluidChart/FluidChart.tsx b/src/components/FluidChart/FluidChart.tsx
index ed3411f55..d4c0eb989 100644
--- a/src/components/FluidChart/FluidChart.tsx
+++ b/src/components/FluidChart/FluidChart.tsx
@@ -55,16 +55,18 @@ const FluidChart: React.FC<FluidChartProps> = ({
     let isEnedisConsentValid = true
     async function loadData() {
       const consumptionService = new ConsumptionService(client)
-      const activateHalfHourLoad = await consumptionService.checkDoctypeEntries(
-        FluidType.ELECTRICITY,
-        TimeStep.HALF_AN_HOUR
-      )
+      let activateHalfHourLoad = false
+      if (fluidType === FluidType.ELECTRICITY) {
+        activateHalfHourLoad = await consumptionService.checkDoctypeEntries(
+          FluidType.ELECTRICITY,
+          TimeStep.HALF_AN_HOUR
+        )
+      }
       if (currentTimeStep === TimeStep.HALF_AN_HOUR && activateHalfHourLoad) {
         isEnedisConsentValid = await consumptionService.checkEnedisHalHourConsent(
           selectedDate
         )
       }
-
       if (subscribed) {
         if (!activateHalfHourLoad) {
           setMinuteBlocked(true)
-- 
GitLab