diff --git a/src/services/profileType.service.spec.ts b/src/services/profileType.service.spec.ts index 73909c5b355fc60f7ae44c7503bf1aae16345228..547c76c0835272cafe21e6ab91117b1418a404b3 100644 --- a/src/services/profileType.service.spec.ts +++ b/src/services/profileType.service.spec.ts @@ -72,142 +72,137 @@ describe('ProfileType service', () => { ) expect(monthConsumption).toEqual(mockMonthConsumption) }) + }) + + describe('getMonthHeating', () => { it('should get the heating consumption', async () => { const monthConsumption = await profileTypeService.getMonthHeating(3) expect(monthConsumption).toEqual(mockMonthConsumption) }) - }) - describe('should get the heating consumption for a flat with collective heating', () => { - const _profileTypeService = new ProfileTypeService( - mockProfileType1, - mockClient, - DateTime.now().year - ) - it('should get the heating consumption', async () => { - const monthConsumption = await _profileTypeService.getMonthHeating(2) + it('should get the heating consumption for a flat with collective heating', async () => { + const profileTypeService1 = new ProfileTypeService( + mockProfileType1, + mockClient, + DateTime.now().year + ) + const monthConsumption = await profileTypeService1.getMonthHeating(2) expect(monthConsumption).toEqual(mockMonthConsumption1) }) - }) - describe('should get the heating consumption for a house with individual heating, facilities, installation and individual work', () => { - const _profileTypeService = new ProfileTypeService( - mockProfileType2, - mockClient, - DateTime.now().year - ) - it('should get the heating consumption', async () => { - const monthConsumption = await _profileTypeService.getMonthHeating(1) + it('should get the heating consumption for a house with individual heating, facilities, installation and individual work', async () => { + const profileTypeService2 = new ProfileTypeService( + mockProfileType2, + mockClient, + DateTime.now().year + ) + const monthConsumption = await profileTypeService2.getMonthHeating(1) expect(monthConsumption).toEqual(mockMonthConsumption2) }) }) + describe('calculateMonthWaterRawNeeds', () => { it('should calculate the water raw needs consumption by month', () => { - const waterRawNeeds = profileTypeService.calculateMonthWaterRawNeeds( - mockProfileType, - 1 - ) + const waterRawNeeds = profileTypeService.calculateMonthWaterRawNeeds(1) expect(waterRawNeeds).toEqual(mockWaterRawNeeds) }) + }) + describe('calculateSpreadNeeds', () => { it('should calculate the water spread needs Consumption', () => { - const waterSpreadNeeds = profileTypeService.calculateSpreadNeeds( - mockProfileType, - 1 - ) + const waterSpreadNeeds = profileTypeService.calculateSpreadNeeds(1) expect(waterSpreadNeeds).toEqual(mockWaterSpreadNeeds) }) + }) + + describe('calculateTotalConsumption', () => { it('should calculate the total ecs consumption by month if profileType.hotWaterEquipment === "solar"', () => { - const monthEcsConsumption = profileTypeService.calculateTotalConsumption( - mockWaterSpreadNeeds, + const profileTypeService1 = new ProfileTypeService( mockProfileType1, + mockClient, + DateTime.now().year + ) + const monthEcsConsumption = profileTypeService1.calculateTotalConsumption( + mockWaterSpreadNeeds, 1 ) expect(monthEcsConsumption).toEqual(mockMonthEcsConsumption1Solar) }) it('should calculate the total ecs consumption by month if profileType.hotWaterEquipment === "other"', () => { - const mockProfileTypeWithOther = { ...mockProfileType } - mockProfileTypeWithOther.hotWaterEquipment = HotWaterEquipment.OTHER - const monthEcsConsumption = profileTypeService.calculateTotalConsumption( - mockWaterSpreadNeeds, + const mockProfileTypeWithOther: ProfileType = { + ...mockProfileType, + hotWaterEquipment: HotWaterEquipment.OTHER, + } + const profileTypeServiceOther = new ProfileTypeService( mockProfileTypeWithOther, - 1 + mockClient, + DateTime.now().year ) + const monthEcsConsumption = + profileTypeServiceOther.calculateTotalConsumption( + mockWaterSpreadNeeds, + 1 + ) expect(monthEcsConsumption).toEqual(mockMonthEcsConsumptionOther) }) + }) + + describe('getMonthEcs', () => { it('should get the ECS consumption if profileType.hotWaterEquipment === "thermodynamic"', () => { - const mockProfileTypeWithOther = { ...mockProfileType } - mockProfileTypeWithOther.hotWaterEquipment = - HotWaterEquipment.THERMODYNAMIC const monthConsumption = profileTypeService.getMonthEcs(1) expect(monthConsumption).toEqual(mockMonthEcsConsumptionThermo) }) + }) - describe('should get the month cooking consumption', () => { - it('should get the month cooking consumption', () => { - const _profileTypeService = new ProfileTypeService( - mockProfileType, - mockClient, - DateTime.now().year - ) - - const monthCookingConsumption = - _profileTypeService.getMonthCookingConsumption(1) - expect(monthCookingConsumption).toEqual(mockMonthCookingConsumption) - }) + describe('getMonthCookingConsumption', () => { + it('should get the month cooking consumption', () => { + const monthCookingConsumption = + profileTypeService.getMonthCookingConsumption(1) + expect(monthCookingConsumption).toEqual(mockMonthCookingConsumption) }) - describe('should get the month electric specific consumption', () => { - it('should get the electric specific consumption', () => { - const _profileTypeService = new ProfileTypeService( - mockProfileType, - mockClient, - DateTime.now().year - ) + }) - const monthElectricSpecificConsumption = - _profileTypeService.getMonthElectricSpecificConsumption(1) - expect(monthElectricSpecificConsumption).toEqual( - mockMonthElectricSpecificConsumption - ) - }) + describe('getMonthElectricSpecificConsumption', () => { + it('should get the electric specific consumption', () => { + const monthElectricSpecificConsumption = + profileTypeService.getMonthElectricSpecificConsumption(1) + expect(monthElectricSpecificConsumption).toEqual( + mockMonthElectricSpecificConsumption + ) }) - describe('should get the month cold water consumption', () => { - it('should get the cold water consumption', () => { - const _profileTypeService = new ProfileTypeService( - mockProfileType, - mockClient, - DateTime.now().year - ) - const monthColdWaterConsumption = - _profileTypeService.getMonthColdWaterConsumption(1) - expect(monthColdWaterConsumption).toEqual(mockMonthColdWaterConsumption) - }) + }) + + describe('getMonthColdWaterConsumption', () => { + it('should get the cold water consumption', () => { + const monthColdWaterConsumption = + profileTypeService.getMonthColdWaterConsumption(1) + expect(monthColdWaterConsumption).toEqual(mockMonthColdWaterConsumption) }) }) - describe('should get the monthly Forecast', () => { - // For month of January - const profileTypeService1 = new ProfileTypeService( - mockTestProfile1, - mockClient, - DateTime.now().year - ) + + describe('getMonthlyForecast for January', () => { it('should get the monthly forecast for test profile 1', async () => { + const profileTypeService1 = new ProfileTypeService( + mockTestProfile1, + mockClient, + DateTime.now().year + ) const monthlyForecast = await profileTypeService1.getMonthlyForecast(1) expect(monthlyForecast).toEqual(mockMonthlyForecastJanuaryTestProfile1) }) - const profileTypeService2 = new ProfileTypeService( - mockTestProfile2, - mockClient, - DateTime.now().year - ) it('should get the monthly forecast for test profile 2', async () => { + const profileTypeService2 = new ProfileTypeService( + mockTestProfile2, + mockClient, + DateTime.now().year + ) const monthlyForecast = await profileTypeService2.getMonthlyForecast(1) expect(monthlyForecast).toEqual(mockMonthlyForecastJanuaryTestProfile2) }) - const profileTypeService3 = new ProfileTypeService( - mockTestProfile3, - mockClient, - DateTime.now().year - ) it('should get the monthly forecast for test profile 3', async () => { + const profileTypeService3 = new ProfileTypeService( + mockTestProfile3, + mockClient, + DateTime.now().year + ) const monthlyForecast = await profileTypeService3.getMonthlyForecast(1) expect(monthlyForecast).toEqual(mockMonthlyForecastJanuaryTestProfile3) }) @@ -222,12 +217,12 @@ describe('ProfileType service', () => { hasInstalledVentilation: ThreeChoicesAnswer.YES, hasReplacedHeater: ThreeChoicesAnswer.YES, } - const _profileTypeService = new ProfileTypeService( + const serviceThreeInsulation = new ProfileTypeService( mockProfileWithThreeInsulation, mockClient, DateTime.now().year ) - const monthlyForecast = await _profileTypeService.getMonthlyForecast(1) + const monthlyForecast = await serviceThreeInsulation.getMonthlyForecast(1) expect(monthlyForecast).toEqual( mockMonthlyForecastJanuaryTest1WithFullArrays ) @@ -254,6 +249,7 @@ describe('ProfileType service', () => { ).toEqual(null) }) }) + describe('getNextFormStep', () => { it('should get the next step in function of the current step', () => { let nextStep = profileTypeFormService.getNextFormStep( @@ -346,6 +342,7 @@ describe('ProfileType service', () => { expect(nextStep).toEqual(ProfileTypeStepForm.HOUSING_TYPE) }) }) + describe('getPreviousFormStep', () => { it('should get the previous step in function of the current step', () => { let previousStep = profileTypeFormService.getPreviousFormStep( @@ -409,6 +406,7 @@ describe('ProfileType service', () => { expect(previousStep).toEqual(ProfileTypeStepForm.HOUSING_TYPE) }) }) + describe('getAnswerForStep', () => { it('should get the good answers in function of the current step', () => { let answers = ProfileTypeFormService.getAnswerForStep( @@ -479,6 +477,7 @@ describe('ProfileType service', () => { expect(answers).toEqual(mockProfileTypeAnswers[16]) }) }) + describe('checkConsistency', () => { it('should return consistent profile for individual house', () => { const mockProfile = { @@ -521,7 +520,8 @@ describe('ProfileType service', () => { expect(result).toEqual(expectedResult) }) }) - describe('getDjU', () => { + + describe('fetchDJU', () => { it('should return default dju', async () => { const result = await profileTypeService.fetchDJU(2) expect(result).toEqual(363) diff --git a/src/services/profileType.service.ts b/src/services/profileType.service.ts index 4f75e33ae964e472df96119dd8d920dc84bc78cc..601b66c0f5ac8261ca98882d5d2f646d8caf0432 100644 --- a/src/services/profileType.service.ts +++ b/src/services/profileType.service.ts @@ -15,7 +15,6 @@ import { HousingType, IndividualInsulationWork, IndividualOrCollective, - OutsideFacingWalls, ThreeChoicesAnswer, } from 'enums' import { DateTime } from 'luxon' @@ -49,18 +48,15 @@ export default class ProfileTypeService { } /** - * calculateWarmingEstimatedConsumption * @returns {number} Estimated consumption */ public calculateWarmingEstimatedConsumption(): number { const ratiosHeating = heatingData.heating_ratio - const housingType: HousingType = this.profileType.housingType - const constructionYear: ConstructionYear = this.profileType.constructionYear + const { area, constructionYear, housingType } = this.profileType const ratiosHeatingByHousingType = ratiosHeating[housingType] - const currentRatio: number = ratiosHeatingByHousingType[constructionYear] - const estimatedConsumption: number = - parseInt(this.profileType.area) * currentRatio + const currentRatio = ratiosHeatingByHousingType[constructionYear] + const estimatedConsumption = parseInt(area) * currentRatio return estimatedConsumption } @@ -71,31 +67,26 @@ export default class ProfileTypeService { public calculateWarmingCorrectedConsumption( estimatedConsumption: number ): number { - const outsideFacingWalls: OutsideFacingWalls = - this.profileType.outsideFacingWalls - const housingType: HousingType = this.profileType.housingType - const floor: Floor = this.profileType.floor - const constructionYear: ConstructionYear = this.profileType.constructionYear - const individualInsulationWork: IndividualInsulationWork[] = - this.profileType.individualInsulationWork - const hasInstalledVentilation: ThreeChoicesAnswer = - this.profileType.hasInstalledVentilation - const hasReplacedHeater: ThreeChoicesAnswer = - this.profileType.hasReplacedHeater - const heating = this.profileType.heating + const { + constructionYear, + floor, + hasInstalledVentilation, + hasReplacedHeater, + heating, + housingType, + individualInsulationWork, + outsideFacingWalls, + } = this.profileType - // Apply corrections + let correctionInsulation: number + let correctionFacilities: number const correctionsNbWalls = heatingData.adjustment_outside_facing_walls[housingType] const correctionWalls: number = correctionsNbWalls[outsideFacingWalls] - - let correctionFloor: number - let correctionInsulation: number - let correctionFacilities: number - - if (this.profileType.housingType === HousingType.APARTMENT) { - correctionFloor = heatingData.adjustment_floor.apartment[floor] - } else correctionFloor = 0 + const correctionFloor = + housingType === HousingType.APARTMENT + ? heatingData.adjustment_floor.apartment[floor] + : 0 if ( !individualInsulationWork.includes(IndividualInsulationWork.NONE) && @@ -181,8 +172,7 @@ export default class ProfileTypeService { } /** - * calculateWarmingMonthConsumption - @returns {number} monthConsumption + * @returns {number} monthConsumption */ public async calculateWarmingMonthConsumption( correctedConsumption: number, @@ -194,8 +184,8 @@ export default class ProfileTypeService { return Math.round(monthConsumption) } + /** - * getMonthHeating * @returns {number} Month heating consumption in kw/h */ public async getMonthHeating(month: number): Promise<number> { @@ -213,31 +203,28 @@ export default class ProfileTypeService { * Calculate water raw needs by month * @returns {number} rawConsumption */ - public calculateMonthWaterRawNeeds( - profileType: ProfileType, - month: number - ): number { - const waterNeedsIndex: number = EcsData.ecs_ratio.findIndex( - ratio => ratio.occupants_number === profileType.occupantsNumber + public calculateMonthWaterRawNeeds(month: number): number { + const waterNeedsIndex = EcsData.ecs_ratio.findIndex( + ratio => ratio.occupants_number === this.profileType.occupantsNumber ) - const waterNeeds: number = + const waterNeeds = EcsData.ecs_ratio[waterNeedsIndex].warm_water_need_in_liter - const nbDaysInMonth: number = DateTime.fromObject({ + const nbDaysInMonth = DateTime.fromObject({ month: month, }).setZone('utc', { keepLocalTime: true, }).daysInMonth - const rawConsumption: number = waterNeeds * nbDaysInMonth + const rawConsumption = waterNeeds * nbDaysInMonth return rawConsumption } /** * Calculate spread water needs by month * @returns {number} spreadConsumption */ - public calculateSpreadNeeds(profileType: ProfileType, month: number): number { + public calculateSpreadNeeds(month: number): number { const rawNeeds: number[] = [] for (let index = 1; index < 13; index++) { - rawNeeds.push(this.calculateMonthWaterRawNeeds(profileType, index)) + rawNeeds.push(this.calculateMonthWaterRawNeeds(index)) } const calculateTotalNeeds = ( accumulator: number, @@ -254,24 +241,21 @@ export default class ProfileTypeService { */ public calculateTotalConsumption( spreadConsumption: number, - profileType: ProfileType, month: number ): number { - const coldWaterTemperature: number = - EcsData.cold_water_temperature[month - 1] - const efficiencyProduction: number = - EcsData.efficiency_production_distribution[profileType.housingType] - const solarCoverage: number = EcsData.solar_coverage[month - 1] - const ecsConsumption: number = + const { housingType, hotWaterEquipment } = this.profileType + const coldWaterTemperature = EcsData.cold_water_temperature[month - 1] + const efficiencyProduction = + EcsData.efficiency_production_distribution[housingType] + const solarCoverage = EcsData.solar_coverage[month - 1] + const ecsConsumption = (((EcsData.coefficient_ecs_consumption * spreadConsumption) / 1000) * (EcsData.hot_water_temperature - coldWaterTemperature)) / efficiencyProduction let monthEcsConsumption: number - if (profileType.hotWaterEquipment === HotWaterEquipment.SOLAR) { + if (hotWaterEquipment === HotWaterEquipment.SOLAR) { monthEcsConsumption = ecsConsumption * (1 - solarCoverage) - } else if ( - profileType.hotWaterEquipment === HotWaterEquipment.THERMODYNAMIC - ) { + } else if (hotWaterEquipment === HotWaterEquipment.THERMODYNAMIC) { monthEcsConsumption = ecsConsumption / EcsData.coefficient_thermodynamic } else { monthEcsConsumption = ecsConsumption @@ -283,13 +267,9 @@ export default class ProfileTypeService { * @returns {number} monthEcsConsumption */ public getMonthEcs(month: number) { - const spreadConsumption: number = this.calculateSpreadNeeds( - this.profileType, - month - ) - const monthEcsConsumption: number = this.calculateTotalConsumption( + const spreadConsumption = this.calculateSpreadNeeds(month) + const monthEcsConsumption = this.calculateTotalConsumption( spreadConsumption, - this.profileType, month ) return monthEcsConsumption @@ -302,12 +282,12 @@ export default class ProfileTypeService { const annualCookingConsumption: number = this.profileType.occupantsNumber * cookingData.ratio_kw_per_person_per_year - const nbDaysInMonth: number = DateTime.fromObject({ + const nbDaysInMonth = DateTime.fromObject({ month: month, }).setZone('utc', { keepLocalTime: true, }).daysInMonth - const monthCookingConsumption: number = + const monthCookingConsumption = (annualCookingConsumption / 365) * nbDaysInMonth return Math.round(monthCookingConsumption) } @@ -320,12 +300,12 @@ export default class ProfileTypeService { elecSpeData[this.profileType.housingType][ this.profileType.constructionYear ] - const nbDaysInMonth: number = DateTime.fromObject({ + const nbDaysInMonth = DateTime.fromObject({ month: month, }).setZone('utc', { keepLocalTime: true, }).daysInMonth - const monthElectricSpecificConsumption: number = + const monthElectricSpecificConsumption = (annualElectricSpecificConsumption / 365) * nbDaysInMonth return Math.round(monthElectricSpecificConsumption) } @@ -340,12 +320,12 @@ export default class ProfileTypeService { ) const coldWaterNeeds: number = coldWaterData[occupantsNumberIndex].consumption_in_liter_per_day - const nbDaysInMonth: number = DateTime.fromObject({ + const nbDaysInMonth = DateTime.fromObject({ month: month, }).setZone('utc', { keepLocalTime: true, }).daysInMonth - const monthColdWaterConsumption: number = nbDaysInMonth * coldWaterNeeds + const monthColdWaterConsumption = nbDaysInMonth * coldWaterNeeds return Math.round(monthColdWaterConsumption) } /** @@ -356,9 +336,7 @@ export default class ProfileTypeService { fluidType: FluidType, month: number ): Promise<DetailsMonthlyForecast> { - const warmingFluid = this.profileType.warmingFluid - const hotWaterFluid = this.profileType.hotWaterFluid - const cookingFluid = this.profileType.cookingFluid + const { cookingFluid, hotWaterFluid, warmingFluid } = this.profileType const detailsMonthlyForecast: DetailsMonthlyForecast = { heatingConsumption: null, @@ -403,8 +381,10 @@ export default class ProfileTypeService { fluidType: FluidType, month: number ): Promise<FluidForecast> { - const detailsMonthlyForecast: DetailsMonthlyForecast = - await this.getDetailsMonthlyForecast(fluidType, month) + const detailsMonthlyForecast = await this.getDetailsMonthlyForecast( + fluidType, + month + ) let fluidLoad = 0 Object.values(detailsMonthlyForecast).forEach(load => { @@ -430,18 +410,12 @@ export default class ProfileTypeService { * @returns {Promise<MonthlyForecast>} MonthlyForecast */ public async getMonthlyForecast(month: number): Promise<MonthlyForecast> { - const elecForecast: FluidForecast = await this.getFluidForecast( + const elecForecast = await this.getFluidForecast( FluidType.ELECTRICITY, month ) - const waterForecast: FluidForecast = await this.getFluidForecast( - FluidType.WATER, - month - ) - const gasForecast: FluidForecast = await this.getFluidForecast( - FluidType.GAS, - month - ) + const waterForecast = await this.getFluidForecast(FluidType.WATER, month) + const gasForecast = await this.getFluidForecast(FluidType.GAS, month) const monthlyForecast = { month: month, @@ -456,7 +430,7 @@ export default class ProfileTypeService { * @returns {Promise<number>} monthDju */ public fetchDJU = async (month: number): Promise<number> => { - const startDate: string = DateTime.local() + const startDate = DateTime.local() .setZone('utc', { keepLocalTime: true, }) @@ -464,7 +438,7 @@ export default class ProfileTypeService { .set({ month: month }) .startOf('month') .toISO() - const endDate: string = DateTime.local() + const endDate = DateTime.local() .setZone('utc', { keepLocalTime: true, }) diff --git a/tests/__mocks__/profileType.mock.ts b/tests/__mocks__/profileType.mock.ts index 37580a53f4211e99059ea7d33a52d4103e5fa2b8..0ae825f44fc43e4ef3d6596526f180ced47e19ee 100644 --- a/tests/__mocks__/profileType.mock.ts +++ b/tests/__mocks__/profileType.mock.ts @@ -15,15 +15,13 @@ import { import { DateTime } from 'luxon' import { MonthlyForecast, ProfileType, ProfileTypeAnswer } from 'models' +const IS_LEAP_YEAR = DateTime.now().isInLeapYear + export const profileTypeData: ProfileType = { - _id: 'ed8a160e06431be15c8fdbb428000f6a', - _rev: '16-f829d012bf290a3f9257be592d8c65d8', - id: 'ed8a160e06431be15c8fdbb428000f6a', area: '64', coldWater: IndividualOrCollective.INDIVIDUAL, constructionYear: ConstructionYear.AFTER_1998, cookingFluid: 0, - facilitiesInstallation: 'none', floor: Floor.INTERMEDIATE_FLOOR, hasInstalledVentilation: ThreeChoicesAnswer.NO, hasReplacedHeater: ThreeChoicesAnswer.NO, @@ -75,9 +73,9 @@ export const mockMonthElectricSpecificConsumption = 175 export const mockMonthColdWaterConsumption = 4247 export const mockWaterRawNeeds = 2480 -export const mockWaterSpreadNeeds = 2701 +export const mockWaterSpreadNeeds = IS_LEAP_YEAR ? 2708 : 2701 export const mockMonthEcsConsumptionOther = 166 -export const mockMonthEcsConsumptionThermo = 110 +export const mockMonthEcsConsumptionThermo = IS_LEAP_YEAR ? 111 : 110 export const mockProfileType1: ProfileType = { housingType: HousingType.APARTMENT, @@ -104,7 +102,7 @@ export const mockProfileType1: ProfileType = { // For the month of February export const mockMonthConsumption1 = 1174 -export const mockMonthEcsConsumption1Solar = 134 +export const mockMonthEcsConsumption1Solar = IS_LEAP_YEAR ? 135 : 134 export const mockProfileType2: ProfileType = { housingType: HousingType.INDIVIDUAL_HOUSE, @@ -184,17 +182,17 @@ export const mockMonthlyForecastJanuaryTestProfile1: MonthlyForecast = { detailsMonthlyForecast: { coldWaterConsumption: null, cookingConsumption: 85, - ecsConsumption: 290, + ecsConsumption: IS_LEAP_YEAR ? 291 : 290, electricSpecificConsumption: null, heatingConsumption: null, }, fluidType: 2, - load: 375, - value: 42.038, + load: IS_LEAP_YEAR ? 376 : 375, + value: IS_LEAP_YEAR ? 42.15 : 42.038, }, ], month: 1, - totalValue: 844.764, + totalValue: IS_LEAP_YEAR ? 844.876 : 844.764, } export const mockTestProfile2: ProfileType = { @@ -226,13 +224,13 @@ export const mockMonthlyForecastJanuaryTestProfile2: MonthlyForecast = { detailsMonthlyForecast: { coldWaterConsumption: null, cookingConsumption: 34, - ecsConsumption: 248, + ecsConsumption: IS_LEAP_YEAR ? 249 : 248, electricSpecificConsumption: 151, heatingConsumption: 1237, }, fluidType: 0, - load: 1670, - value: 290.58, + load: IS_LEAP_YEAR ? 1671 : 1670, + value: IS_LEAP_YEAR ? 290.75 : 290.58, }, { detailsMonthlyForecast: { @@ -260,7 +258,7 @@ export const mockMonthlyForecastJanuaryTestProfile2: MonthlyForecast = { }, ], month: 1, - totalValue: 317.676, + totalValue: IS_LEAP_YEAR ? 317.846 : 317.676, } export const mockTestProfile3: ProfileType = { @@ -457,15 +455,15 @@ export const mockMonthlyForecastJanuaryTest1WithFullArrays: MonthlyForecast = { detailsMonthlyForecast: { coldWaterConsumption: null, cookingConsumption: 85, - ecsConsumption: 290, + ecsConsumption: IS_LEAP_YEAR ? 291 : 290, electricSpecificConsumption: null, heatingConsumption: null, }, fluidType: 2, - load: 375, - value: 42.038, + load: IS_LEAP_YEAR ? 376 : 375, + value: IS_LEAP_YEAR ? 42.15 : 42.038, }, ], month: 1, - totalValue: 567.234, + totalValue: IS_LEAP_YEAR ? 567.346 : 567.234, }