From 3ec3dca37d92d38a79a4abe52df37364a5ff435c Mon Sep 17 00:00:00 2001 From: Bastien DUMONT <bdumont@grandlyon.com> Date: Mon, 1 Jul 2024 11:34:07 +0000 Subject: [PATCH] fix(analysis): apple prices for forecast --- .vscode/settings.json | 1 + .../ProfileComparator/ProfileComparator.tsx | 9 +- .../ProfileComparatorRow.tsx | 63 +++-- .../ProfileComparator.spec.tsx.snap | 231 +++++++++--------- .../ProfileComparator/profileComparator.scss | 4 +- .../profileComparatorRow.scss | 1 - src/services/consumption.service.ts | 9 +- src/services/converter.service.spec.ts | 2 +- src/services/converter.service.ts | 18 +- src/services/fluidsPrices.service.ts | 8 +- src/services/profileType.service.spec.ts | 5 + src/services/profileType.service.ts | 23 +- src/targets/services/fluidsPrices.ts | 12 +- tests/__mocks__/fluidPrice.mock.ts | 9 + tests/__mocks__/profileType.mock.ts | 48 ++-- 15 files changed, 223 insertions(+), 220 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 05e6af925..cc6c8aa7e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -54,6 +54,7 @@ "barchart", "camelcase", "cicid", + "coeff", "CONSO", "cozybar", "cozycloud", diff --git a/src/components/Analysis/ProfileComparator/ProfileComparator.tsx b/src/components/Analysis/ProfileComparator/ProfileComparator.tsx index 90db50877..7d47de935 100644 --- a/src/components/Analysis/ProfileComparator/ProfileComparator.tsx +++ b/src/components/Analysis/ProfileComparator/ProfileComparator.tsx @@ -154,7 +154,7 @@ const ProfileComparator = ({ </div> ) - const Consumption = ( + const comparison = ( <div className="analysis-graph"> {isLoading ? ( <div className="loader-container"> @@ -164,7 +164,6 @@ const ProfileComparator = ({ <> <div className="consumption-title text-20-bold"> <div className="user-title">{t('analysis.user_consumption')}</div> - <div /> <div className="average-title">{t(`analysis.comparison`)}</div> </div> <ProfileComparatorRow @@ -262,10 +261,8 @@ const ProfileComparator = ({ )} </div> - <div className="analysis-graph"> - {!profile.isProfileTypeCompleted && profileNotCompleted} - {profile.isProfileTypeCompleted && Consumption} - </div> + {!profile.isProfileTypeCompleted && profileNotCompleted} + {profile.isProfileTypeCompleted && comparison} </> ) } diff --git a/src/components/Analysis/ProfileComparator/ProfileComparatorRow.tsx b/src/components/Analysis/ProfileComparator/ProfileComparatorRow.tsx index 5d9fcb185..12c6d9080 100644 --- a/src/components/Analysis/ProfileComparator/ProfileComparatorRow.tsx +++ b/src/components/Analysis/ProfileComparator/ProfileComparatorRow.tsx @@ -41,65 +41,58 @@ const ProfileComparatorRow = ({ const FLUIDNAME = getFluidName(fluidType).toUpperCase() const fluidLoad = - forecast && !isMulti ? forecast.fluidForecast[fluidType].load : 0 + !isMulti && forecast ? forecast.fluidForecast[fluidType].load : 0 const formatFluidConsumptionForConso = () => { if (isMulti) { return `${formatNumberValues(userPriceConsumption).toString()} €` - } else { - if (performanceValue) { - // keeps unit in kWh for electricity and gas - if (isElecOrGas) { - return `${Math.round(performanceValue)} ${t( - `FLUID.${FLUIDNAME}.UNIT` - )}` - } - return performanceValue >= 1000 || fluidLoad >= 1000 - ? formatNumberValues(performanceValue / 1000).toString() + - ' ' + - t(`FLUID.${FLUIDNAME}.MEGAUNIT`) - : Math.round(performanceValue) + ' ' + t(`FLUID.${FLUIDNAME}.UNIT`) - } else { - return '-' + } + if (performanceValue) { + // keeps unit in kWh for electricity and gas + if (isElecOrGas) { + return `${Math.round(performanceValue)} ${t(`FLUID.${FLUIDNAME}.UNIT`)}` } + return performanceValue >= 1000 || fluidLoad >= 1000 + ? formatNumberValues(performanceValue / 1000).toString() + + ' ' + + t(`FLUID.${FLUIDNAME}.MEGAUNIT`) + : Math.round(performanceValue) + ' ' + t(`FLUID.${FLUIDNAME}.UNIT`) } + return '-' } const formatFluidConsumptionForForecast = () => { if (isMulti) { return `${formatNumberValues(homePriceConsumption).toString()} €` - } else { - // keeps unit in kWh for electricity and gas - if (isElecOrGas) { - return `${Math.round(fluidLoad)} ${t('FLUID.' + FLUIDNAME + '.UNIT')}` - } - return (performanceValue && performanceValue >= 1000) || fluidLoad >= 1000 - ? formatNumberValues(fluidLoad / 1000).toString() + - ' ' + - t(`FLUID.${FLUIDNAME}.MEGAUNIT`) - : Math.round(fluidLoad) + ' ' + t(`FLUID.${FLUIDNAME}.UNIT`) } + // keeps unit in kWh for electricity and gas + if (isElecOrGas) { + return `${Math.round(fluidLoad)} ${t(`FLUID.${FLUIDNAME}.UNIT`)}` + } + return (performanceValue && performanceValue >= 1000) || fluidLoad >= 1000 + ? formatNumberValues(fluidLoad / 1000).toString() + + ' ' + + t(`FLUID.${FLUIDNAME}.MEGAUNIT`) + : Math.round(fluidLoad) + ' ' + t(`FLUID.${FLUIDNAME}.UNIT`) } const getWidthForConso = () => { if (isMulti) { return `${(userPriceConsumption / maxPriceConsumption) * 100}%` - } else { - return `${ - (converterService.LoadToEuro(performanceValue || 0, fluidType) / - maxPriceConsumption) * - 100 - }%` } + return `${ + (converterService.LoadToEuro(performanceValue || 0, fluidType) / + maxPriceConsumption) * + 100 + }%` } const getWidthForForecast = () => { if (isMulti) { return `${(homePriceConsumption / maxPriceConsumption) * 100}%` - } else { - const fluidValue = forecast ? forecast.fluidForecast[fluidType].value : 0 - return `${(fluidValue / maxPriceConsumption) * 100}%` } + const fluidValue = forecast ? forecast.fluidForecast[fluidType].value : 0 + return `${(fluidValue / maxPriceConsumption) * 100}%` } const comparaisonText = connected diff --git a/src/components/Analysis/ProfileComparator/__snapshots__/ProfileComparator.spec.tsx.snap b/src/components/Analysis/ProfileComparator/__snapshots__/ProfileComparator.spec.tsx.snap index 0ec6fdfe3..d8f55b5d7 100644 --- a/src/components/Analysis/ProfileComparator/__snapshots__/ProfileComparator.spec.tsx.snap +++ b/src/components/Analysis/ProfileComparator/__snapshots__/ProfileComparator.spec.tsx.snap @@ -24,43 +24,39 @@ exports[`AnalysisConsumption component should be rendered correctly with profile </div> </div> <div - class="analysis-graph" + class="no-profile" > <div - class="no-profile" + class="text-16-normal" > - <div - class="text-16-normal" - > - analysis.approximative_description - </div> - <button - aria-label="analysis.accessibility.button_go_to_profil" - class="MuiButtonBase-root MuiButton-root btnPrimary MuiButton-text MuiButton-textSizeLarge MuiButton-sizeLarge" - data-testid="goToProfile" - tabindex="0" - type="button" - > - <span - class="MuiButton-label text-18-bold" - > - analysis.accessibility.button_go_to_profil - </span> - <span - class="MuiTouchRipple-root" - /> - </button> - <svg - alt="pas de profil remplis" - class="styles__icon___23x3R" - height="60%" - width="100%" - > - <use - xlink:href="#test-file-stub" - /> - </svg> + analysis.approximative_description </div> + <button + aria-label="analysis.accessibility.button_go_to_profil" + class="MuiButtonBase-root MuiButton-root btnPrimary MuiButton-text MuiButton-textSizeLarge MuiButton-sizeLarge" + data-testid="goToProfile" + tabindex="0" + type="button" + > + <span + class="MuiButton-label text-18-bold" + > + analysis.accessibility.button_go_to_profil + </span> + <span + class="MuiTouchRipple-root" + /> + </button> + <svg + alt="pas de profil remplis" + class="styles__icon___23x3R" + height="60%" + width="100%" + > + <use + xlink:href="#test-file-stub" + /> + </svg> </div> </div> `; @@ -117,116 +113,111 @@ exports[`AnalysisConsumption component should be rendered correctly with profile class="analysis-graph" > <div - class="analysis-graph" + class="consumption-title text-20-bold" > <div - class="consumption-title text-20-bold" + class="user-title" > - <div - class="user-title" - > - analysis.user_consumption - </div> - <div /> - <div - class="average-title" - > - analysis.comparison - </div> + analysis.user_consumption </div> - <mock-profilecomparatorrow - connected="true" - fluidtype="3" - homepriceconsumption="0" - nodata="false" - userpriceconsumption="156.161853" - /> - <mock-profilecomparatorrow - connected="true" - fluidtype="0" - homepriceconsumption="0" - nodata="false" - performancevalue="178.54" - userpriceconsumption="156.161853" - /> - <mock-profilecomparatorrow - connected="true" - fluidtype="1" - homepriceconsumption="0" - nodata="false" - performancevalue="7763.98" - userpriceconsumption="156.161853" - /> - <mock-profilecomparatorrow - connected="true" - fluidtype="2" - homepriceconsumption="0" - nodata="false" - performancevalue="1317.67" - userpriceconsumption="156.161853" - /> <div - class="MuiPaper-root MuiAccordion-root expansion-panel-root MuiAccordion-rounded MuiPaper-elevation1 MuiPaper-rounded" + class="average-title" + > + analysis.comparison + </div> + </div> + <mock-profilecomparatorrow + connected="true" + fluidtype="3" + homepriceconsumption="0" + nodata="false" + userpriceconsumption="156.161853" + /> + <mock-profilecomparatorrow + connected="true" + fluidtype="0" + homepriceconsumption="0" + nodata="false" + performancevalue="178.54" + userpriceconsumption="156.161853" + /> + <mock-profilecomparatorrow + connected="true" + fluidtype="1" + homepriceconsumption="0" + nodata="false" + performancevalue="7763.98" + userpriceconsumption="156.161853" + /> + <mock-profilecomparatorrow + connected="true" + fluidtype="2" + homepriceconsumption="0" + nodata="false" + performancevalue="1317.67" + userpriceconsumption="156.161853" + /> + <div + class="MuiPaper-root MuiAccordion-root expansion-panel-root MuiAccordion-rounded MuiPaper-elevation1 MuiPaper-rounded" + > + <div + aria-disabled="false" + aria-expanded="false" + aria-label="profile_type.accessibility.button_toggle_average_home" + class="MuiButtonBase-root MuiAccordionSummary-root expansion-panel-summary" + role="button" + tabindex="0" > <div - aria-disabled="false" - aria-expanded="false" - aria-label="profile_type.accessibility.button_toggle_average_home" - class="MuiButtonBase-root MuiAccordionSummary-root expansion-panel-summary" - role="button" - tabindex="0" + class="MuiAccordionSummary-content expansion-panel-content" > <div - class="MuiAccordionSummary-content expansion-panel-content" + class="accordion-title accordion-title" > - <div - class="accordion-title accordion-title" - > - analysis.average_home - </div> + analysis.average_home </div> - <div - aria-disabled="false" - aria-hidden="true" - class="MuiButtonBase-root MuiIconButton-root MuiAccordionSummary-expandIcon MuiIconButton-edgeEnd" + </div> + <div + aria-disabled="false" + aria-hidden="true" + class="MuiButtonBase-root MuiIconButton-root MuiAccordionSummary-expandIcon MuiIconButton-edgeEnd" + > + <span + class="MuiIconButton-label" > - <span - class="MuiIconButton-label" + <svg + class="accordion-icon styles__icon___23x3R" + height="16" + width="16" > - <svg - class="accordion-icon styles__icon___23x3R" - height="16" - width="16" - > - <use - xlink:href="#test-file-stub" - /> - </svg> - </span> - </div> + <use + xlink:href="#test-file-stub" + /> + </svg> + </span> </div> + </div> + <div + class="MuiCollapse-root MuiCollapse-hidden" + style="min-height: 0px;" + > <div - class="MuiCollapse-root MuiCollapse-hidden" - style="min-height: 0px;" + class="MuiCollapse-wrapper" > <div - class="MuiCollapse-wrapper" + class="MuiCollapse-wrapperInner" > <div - class="MuiCollapse-wrapperInner" + role="region" > <div - role="region" + class="MuiAccordionDetails-root expansion-panel-details" > - <div - class="MuiAccordionDetails-root expansion-panel-details" + <span + class="accordion-desc text-16-normal" > - <span - class="accordion-desc text-16-normal" - > - analysis.average_home_description - </span> - </div> + analysis.average_home_description + </span> </div> </div> </div> diff --git a/src/components/Analysis/ProfileComparator/profileComparator.scss b/src/components/Analysis/ProfileComparator/profileComparator.scss index 6ca14b923..369ab0598 100644 --- a/src/components/Analysis/ProfileComparator/profileComparator.scss +++ b/src/components/Analysis/ProfileComparator/profileComparator.scss @@ -2,10 +2,12 @@ @import 'src/styles/base/breakpoint'; .analysis-graph { + display: flex; + flex-direction: column; + gap: 1rem; .consumption-title { display: flex; justify-content: space-between; - margin-bottom: 1rem; .user-title, .average-title { flex-basis: 45%; diff --git a/src/components/Analysis/ProfileComparator/profileComparatorRow.scss b/src/components/Analysis/ProfileComparator/profileComparatorRow.scss index 898ca8eb4..d04be0535 100644 --- a/src/components/Analysis/ProfileComparator/profileComparatorRow.scss +++ b/src/components/Analysis/ProfileComparator/profileComparatorRow.scss @@ -3,7 +3,6 @@ .analysisRow { display: flex; - margin-bottom: 1rem; .user-graph { .container-graph { justify-content: flex-end; diff --git a/src/services/consumption.service.ts b/src/services/consumption.service.ts index 57ccc0eb3..d3572ee6e 100644 --- a/src/services/consumption.service.ts +++ b/src/services/consumption.service.ts @@ -166,7 +166,7 @@ export default class ConsumptionDataManager { ): Promise<PerformanceIndicator[]> { const performanceIndicators: PerformanceIndicator[] = [] for (const fluidType of fluidTypes) { - const graphData: Datachart | null = await this.getGraphData( + const graphData = await this.getGraphData( timePeriod, timeStep, [fluidType], @@ -294,7 +294,7 @@ export default class ConsumptionDataManager { ): Datachart | null { if (!data) return null - const formattedActualData: Dataload[] = + const formattedActualData = this._consumptionFormatterService.formatGraphData( data.actualData, timePeriod, @@ -636,14 +636,14 @@ export default class ConsumptionDataManager { year: number, month: number ): Promise<number | null> => { - const bronStationId = '69123002' + const BronStationId = '69123002' const avgTemperatureDate = `${year}-${formatTwoDigits(month)}` try { const result: AvgTemperatureResult = await this._client .getStackClient() .fetchJSON( 'GET', - `${REMOTE_ORG_ECOLYO_AVG_TEMPERATURE}?identifiant=${bronStationId}&month=${avgTemperatureDate}` + `${REMOTE_ORG_ECOLYO_AVG_TEMPERATURE}?identifiant=${BronStationId}&month=${avgTemperatureDate}` ) if (result && result.nb_results !== 0) { return result.values[0].average_measurement @@ -684,7 +684,6 @@ export default class ConsumptionDataManager { ): Promise<DataloadEntity[]> { const { data: savedDocs }: QueryResult<DataloadEntity[]> = await this._client.saveAll(consumptionDocs) - return savedDocs } } diff --git a/src/services/converter.service.spec.ts b/src/services/converter.service.spec.ts index 85868150a..133988768 100644 --- a/src/services/converter.service.spec.ts +++ b/src/services/converter.service.spec.ts @@ -39,7 +39,7 @@ describe('Converter service', () => { expect(result).toEqual(expectedConversion) }) - it('should return 1.2 beacause there is a price of 1.2 set for doctype', () => { + it('should return 1.2 because there is a price of 1.2 set for doctype', () => { const expectedConversion = 1.2 const result = converterService.LoadToEuro(0.002, FluidType.WATER, 1.2) expect(result).toEqual(expectedConversion) diff --git a/src/services/converter.service.ts b/src/services/converter.service.ts index d283508b4..aeee1ea2d 100644 --- a/src/services/converter.service.ts +++ b/src/services/converter.service.ts @@ -19,7 +19,11 @@ export default class ConverterService { if (fluidType === FluidType.MULTIFLUID) { convertedLoad = load } else { - convertedLoad = this.applyPrice(this._fluidConfig[fluidType], load, price) + convertedLoad = this.computePrice( + this._fluidConfig[fluidType], + load, + price + ) } // Prevent round 0 case when the actual value is not 0 @@ -30,20 +34,18 @@ export default class ConverterService { } /** - * Return calculated price + * Compute calculated price + * If a price is provided, return the price * @param {FluidConfig} fluidConfig - Fluid configuration * @param {number} load - Load value * @param {number} [price] - Price if exist */ - private applyPrice( + private computePrice( fluidConfig: FluidConfig, load: number, price?: number | null ): number { - if (price) { - return price - } else { - return load * fluidConfig.coefficient - } + if (price) return price + return load * fluidConfig.coefficient } } diff --git a/src/services/fluidsPrices.service.ts b/src/services/fluidsPrices.service.ts index 5a16cf3ae..525dd3d25 100644 --- a/src/services/fluidsPrices.service.ts +++ b/src/services/fluidsPrices.service.ts @@ -115,7 +115,7 @@ export default class FluidPricesService { } /** - * Check if a fluidprice exists in db + * Check if a fluidPrice exists in db * @returns {Promise<FluidPrice | null>} price or null */ public async checkIfPriceExists( @@ -129,7 +129,7 @@ export default class FluidPricesService { data: [price], }: QueryResult<FluidPrice[]> = await this._client.query(query) if (price) return price - else return null + return null } /** @@ -164,9 +164,7 @@ export default class FluidPricesService { ...doc, ...attributes, }) - if (fluidPrice) { - return fluidPrice - } + if (fluidPrice) return fluidPrice return null } } diff --git a/src/services/profileType.service.spec.ts b/src/services/profileType.service.spec.ts index d7d7fa389..5625bad4a 100644 --- a/src/services/profileType.service.spec.ts +++ b/src/services/profileType.service.spec.ts @@ -14,6 +14,7 @@ import { DateTime } from 'luxon' import { DjuResult } from 'models' import { ProfileType } from 'models/profileType.model' import mockClient from 'tests/__mocks__/client.mock' +import { mockFluidPrice } from 'tests/__mocks__/fluidPrice.mock' import { mockCorrectedConsumption, mockEstimatedConsumption, @@ -40,9 +41,12 @@ import { mockWaterRawNeeds, mockWaterSpreadNeeds, } from 'tests/__mocks__/profileType.mock' +import FluidPricesService from './fluidsPrices.service' import ProfileTypeService from './profileType.service' import ProfileTypeFormService from './profileTypeForm.service' +const mockGetPrices = jest.spyOn(FluidPricesService.prototype, 'getPrices') + const unknownStep = 99999 as ProfileTypeStepForm describe('ProfileType service', () => { const profileTypeService = new ProfileTypeService( @@ -189,6 +193,7 @@ describe('ProfileType service', () => { }) describe('getMonthlyForecast for January', () => { + mockGetPrices.mockResolvedValue(mockFluidPrice) it('should get the monthly forecast for test profile 1', async () => { const profileTypeService1 = new ProfileTypeService( mockTestProfile1, diff --git a/src/services/profileType.service.ts b/src/services/profileType.service.ts index 91d05dd9f..5ab122541 100644 --- a/src/services/profileType.service.ts +++ b/src/services/profileType.service.ts @@ -28,6 +28,7 @@ import { import logApp from 'utils/logger' import { formatTwoDigits } from 'utils/utils' import ConverterService from './converter.service' +import FluidPricesService from './fluidsPrices.service' const logStack = logger.namespace('profileTypeService') @@ -383,11 +384,17 @@ export default class ProfileTypeService { return detailsMonthlyForecast } + /** + * Get fluid forecast with adjusted price + */ public async getFluidForecast( fluidType: FluidType, year: number, month: number ): Promise<FluidForecast> { + const converterService = new ConverterService() + const fluidsPricesService = new FluidPricesService(this._client) + const detailsMonthlyForecast = await this.getDetailsMonthlyForecast( fluidType, year, @@ -399,15 +406,23 @@ export default class ProfileTypeService { if (load !== null) fluidLoad += load }) - const converterService = new ConverterService() - const fluidValue = parseFloat( - converterService.LoadToEuro(fluidLoad, fluidType).toPrecision(5) + const date = DateTime.fromObject({ + year: year, + month: month, + }) + const priceData = await fluidsPricesService.getPrices(fluidType, date) + const priceForecast = fluidLoad * priceData.price + + const fluidPrice = parseFloat( + converterService + .LoadToEuro(fluidLoad, fluidType, priceForecast) + .toPrecision(5) ) const fluidForecast: FluidForecast = { fluidType: fluidType, load: fluidLoad, - value: fluidValue, + value: fluidPrice, detailsMonthlyForecast: detailsMonthlyForecast, } return fluidForecast diff --git a/src/targets/services/fluidsPrices.ts b/src/targets/services/fluidsPrices.ts index 32ad62df0..2deb27c14 100644 --- a/src/targets/services/fluidsPrices.ts +++ b/src/targets/services/fluidsPrices.ts @@ -89,14 +89,6 @@ const synchroPricesToUpdate = async ( } } -const price = (item: DataloadEntity): number => { - return item.price ? item.price : 0 -} - -const sum = (prev: number, next: number): number => { - return prev + next -} - const getTimePeriod = async ( timeStep: TimeStep, date: DateTime @@ -161,7 +153,9 @@ const aggregatePrices = async ( ) if (docToUpdate?.data && dayDocuments?.data) { - docToUpdate.data[0].price = dayDocuments.data.map(price).reduce(sum) + docToUpdate.data[0].price = dayDocuments.data + .map((item: DataloadEntity) => item.price || 0) + .reduce((a: number, b: number) => a + b) } await cdm.saveDocs(docToUpdate?.data) // Update date according to timestep diff --git a/tests/__mocks__/fluidPrice.mock.ts b/tests/__mocks__/fluidPrice.mock.ts index b93fac787..19ab4a3a3 100644 --- a/tests/__mocks__/fluidPrice.mock.ts +++ b/tests/__mocks__/fluidPrice.mock.ts @@ -1,5 +1,14 @@ import { FluidPrice } from 'models' +export const mockFluidPrice: FluidPrice = { + _id: 'e8510c85cd44734b58fd2f587200975c', + UpdatedAt: '2024-06-26T07:55:06.093Z', + endDate: '', + fluidType: 0, + price: 0.2516, + startDate: '2024-02-01T00:00:00Z', +} + export const fluidPrices: FluidPrice[] = [ { _id: '03045ea1afecc7a86e5443a52e00b07d', diff --git a/tests/__mocks__/profileType.mock.ts b/tests/__mocks__/profileType.mock.ts index 0ae825f44..5a0c69dc5 100644 --- a/tests/__mocks__/profileType.mock.ts +++ b/tests/__mocks__/profileType.mock.ts @@ -15,8 +15,6 @@ import { import { DateTime } from 'luxon' import { MonthlyForecast, ProfileType, ProfileTypeAnswer } from 'models' -const IS_LEAP_YEAR = DateTime.now().isInLeapYear - export const profileTypeData: ProfileType = { area: '64', coldWater: IndividualOrCollective.INDIVIDUAL, @@ -73,9 +71,9 @@ export const mockMonthElectricSpecificConsumption = 175 export const mockMonthColdWaterConsumption = 4247 export const mockWaterRawNeeds = 2480 -export const mockWaterSpreadNeeds = IS_LEAP_YEAR ? 2708 : 2701 +export const mockWaterSpreadNeeds = 2708 export const mockMonthEcsConsumptionOther = 166 -export const mockMonthEcsConsumptionThermo = IS_LEAP_YEAR ? 111 : 110 +export const mockMonthEcsConsumptionThermo = 111 export const mockProfileType1: ProfileType = { housingType: HousingType.APARTMENT, @@ -102,7 +100,7 @@ export const mockProfileType1: ProfileType = { // For the month of February export const mockMonthConsumption1 = 1174 -export const mockMonthEcsConsumption1Solar = IS_LEAP_YEAR ? 135 : 134 +export const mockMonthEcsConsumption1Solar = 135 export const mockProfileType2: ProfileType = { housingType: HousingType.INDIVIDUAL_HOUSE, @@ -164,7 +162,7 @@ export const mockMonthlyForecastJanuaryTestProfile1: MonthlyForecast = { }, fluidType: 0, load: 4340, - value: 755.16, + value: 1091.9, }, { detailsMonthlyForecast: { @@ -176,23 +174,23 @@ export const mockMonthlyForecastJanuaryTestProfile1: MonthlyForecast = { }, fluidType: 1, load: 14911, - value: 47.566, + value: 3751.6, }, { detailsMonthlyForecast: { coldWaterConsumption: null, cookingConsumption: 85, - ecsConsumption: IS_LEAP_YEAR ? 291 : 290, + ecsConsumption: 291, electricSpecificConsumption: null, heatingConsumption: null, }, fluidType: 2, - load: IS_LEAP_YEAR ? 376 : 375, - value: IS_LEAP_YEAR ? 42.15 : 42.038, + load: 376, + value: 94.602, }, ], month: 1, - totalValue: IS_LEAP_YEAR ? 844.876 : 844.764, + totalValue: 4938.102, } export const mockTestProfile2: ProfileType = { @@ -224,13 +222,13 @@ export const mockMonthlyForecastJanuaryTestProfile2: MonthlyForecast = { detailsMonthlyForecast: { coldWaterConsumption: null, cookingConsumption: 34, - ecsConsumption: IS_LEAP_YEAR ? 249 : 248, + ecsConsumption: 249, electricSpecificConsumption: 151, heatingConsumption: 1237, }, fluidType: 0, - load: IS_LEAP_YEAR ? 1671 : 1670, - value: IS_LEAP_YEAR ? 290.75 : 290.58, + load: 1671, + value: 420.42, }, { detailsMonthlyForecast: { @@ -242,7 +240,7 @@ export const mockMonthlyForecastJanuaryTestProfile2: MonthlyForecast = { }, fluidType: 1, load: 8494, - value: 27.096, + value: 2137.1, }, { detailsMonthlyForecast: { @@ -258,7 +256,7 @@ export const mockMonthlyForecastJanuaryTestProfile2: MonthlyForecast = { }, ], month: 1, - totalValue: IS_LEAP_YEAR ? 317.846 : 317.676, + totalValue: 2557.52, } export const mockTestProfile3: ProfileType = { @@ -296,7 +294,7 @@ export const mockMonthlyForecastJanuaryTestProfile3: MonthlyForecast = { }, fluidType: 0, load: 194, - value: 33.756, + value: 48.81, }, { detailsMonthlyForecast: { @@ -308,7 +306,7 @@ export const mockMonthlyForecastJanuaryTestProfile3: MonthlyForecast = { }, fluidType: 1, load: 8494, - value: 27.096, + value: 2137.1, }, { detailsMonthlyForecast: { @@ -324,7 +322,7 @@ export const mockMonthlyForecastJanuaryTestProfile3: MonthlyForecast = { }, ], month: 1, - totalValue: 60.852000000000004, + totalValue: 2185.91, } export const mockProfileTypeAnswers: ProfileTypeAnswer[] = [ @@ -437,7 +435,7 @@ export const mockMonthlyForecastJanuaryTest1WithFullArrays: MonthlyForecast = { }, fluidType: 0, load: 2745, - value: 477.63, + value: 690.64, }, { detailsMonthlyForecast: { @@ -449,21 +447,21 @@ export const mockMonthlyForecastJanuaryTest1WithFullArrays: MonthlyForecast = { }, fluidType: 1, load: 14911, - value: 47.566, + value: 3751.6, }, { detailsMonthlyForecast: { coldWaterConsumption: null, cookingConsumption: 85, - ecsConsumption: IS_LEAP_YEAR ? 291 : 290, + ecsConsumption: 291, electricSpecificConsumption: null, heatingConsumption: null, }, fluidType: 2, - load: IS_LEAP_YEAR ? 376 : 375, - value: IS_LEAP_YEAR ? 42.15 : 42.038, + load: 376, + value: 94.602, }, ], month: 1, - totalValue: IS_LEAP_YEAR ? 567.346 : 567.234, + totalValue: 4536.842, } -- GitLab