diff --git a/src/components/ContainerComponents/FluidChartContainer/FluidChartContainer.tsx b/src/components/ContainerComponents/FluidChartContainer/FluidChartContainer.tsx index 9a414ff802e4d328da2ade14cf7d6b563a7066f0..4feb58fdd6b0702153034ab823ffec02fb2b8ef0 100644 --- a/src/components/ContainerComponents/FluidChartContainer/FluidChartContainer.tsx +++ b/src/components/ContainerComponents/FluidChartContainer/FluidChartContainer.tsx @@ -32,7 +32,7 @@ const FluidChartContainer: React.FC<FluidChartContainerProps> = ({ const [lastDateWithAllData, setLastDateWithAllData] = useState<DateTime>( DateTime.local() ) - const [isMinuteActive, setMinuteActive] = useState<boolean>(false) + const [isMinuteBlocked, setMinuteBlocked] = useState<boolean>(false) const [referenceDate, setReferenceDate] = useState<DateTime>(DateTime.local()) const [isLoaded, setIsLoaded] = useState<boolean>(false) const [challenge, setChallenge] = useState<UserChallenge | null>(null) @@ -47,7 +47,7 @@ const FluidChartContainer: React.FC<FluidChartContainerProps> = ({ useEffect(() => { let subscribed = true async function loadData() { - const halfHourLoad = await consumptionDataManager.checkDoctypeEntries( + const activateHalfHourLoad = await consumptionDataManager.checkDoctypeEntries( FluidType.ELECTRICITY, TimeStep.HALF_AN_HOUR ) @@ -63,8 +63,8 @@ const FluidChartContainer: React.FC<FluidChartContainerProps> = ({ if (subscribed && dataWithAllFluids) { setLastDateWithAllData(dataWithAllFluids) } - if (subscribed && halfHourLoad) { - setMinuteActive(true) + if (subscribed && activateHalfHourLoad) { + setMinuteBlocked(true) } if (subscribed && currentChallenge) { if ( @@ -119,7 +119,7 @@ const FluidChartContainer: React.FC<FluidChartContainerProps> = ({ lastDateWithAllData={lastDateWithAllData} fluidTypes={fluidTypes} timeStep={timeStep} - halfHourLoad={isMinuteActive} + activateHalfHourLoad={isMinuteBlocked} multiFluid={multiFluid} currentChallenge={challenge} consumptionDataManager={consumptionDataManager} diff --git a/src/components/ContentComponents/FluidChart/FluidChartContent.tsx b/src/components/ContentComponents/FluidChart/FluidChartContent.tsx index 85228a569052a40f4d0375dd118773be5a6a29c7..45de13f3563610d124fb92754bc3a50490a8d0a4 100644 --- a/src/components/ContentComponents/FluidChart/FluidChartContent.tsx +++ b/src/components/ContentComponents/FluidChart/FluidChartContent.tsx @@ -31,7 +31,7 @@ interface FluidChartContentProps { referenceDate: DateTime lastDataDate: DateTime lastDateWithAllData: DateTime - halfHourLoad: boolean + activateHalfHourLoad: boolean multiFluid: boolean currentChallenge: UserChallenge | null consumptionDataManager: IConsumptionDataManager @@ -47,7 +47,7 @@ const FluidChartContent: React.FC<FluidChartContentProps> = ({ lastDataDate, lastDateWithAllData, multiFluid, - halfHourLoad, + activateHalfHourLoad, currentChallenge, consumptionDataManager, isDataLoaded, @@ -76,6 +76,7 @@ const FluidChartContent: React.FC<FluidChartContentProps> = ({ setIndexDisplayed(index) setIsLoaded(false) } + console.log('HOUR LOAD is : ', activateHalfHourLoad, timeStep) const handleClickData = ( dataload: IDataload, @@ -142,7 +143,7 @@ const FluidChartContent: React.FC<FluidChartContentProps> = ({ /> </div> - {!halfHourLoad && timeStep === 10 && ( + {activateHalfHourLoad && timeStep === 10 && ( <ActivateHalfHourLoad timeStep={timeStep} /> )} diff --git a/src/services/consumptionDataManagerService.ts b/src/services/consumptionDataManagerService.ts index ff2d6ec33e0e4b35a9c6df861ede69c0b3f33605..4fa240e306bccf272ab4a710d0b1d7a5dc7e50a4 100644 --- a/src/services/consumptionDataManagerService.ts +++ b/src/services/consumptionDataManagerService.ts @@ -293,9 +293,9 @@ export default class ConsumptionDataManager implements IConsumptionDataManager { ): Promise<boolean> { const queryResult = await this._queryRunner.getEntries(fluideType, timeStep) if (queryResult.length > 0) { - return true + return false } - return false + return true } private aggregateGraphData(