Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ export class PerteChRecupService {
*/
execute(ctx, logement) {
return {
pertes_generateur_ch_recup: this.pertesGenerateurChRecup(ctx, logement, false) / 1000,
pertes_generateur_ch_recup_depensier: this.pertesGenerateurChRecup(ctx, logement, true) / 1000
pertes_generateur_ch_recup:
this.pertesGenerateurChRecup(ctx, logement, false) / (1000 * 1000),
Copy link
Collaborator

@michaeldesigaud michaeldesigaud Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kaiohz pour info cette classe est une initiative de refacto que l'on retrouve avec d'autres classes sous le dossier src/features/engine. Or ces classes ne sont pour l'instant par appelées.

Le code à modifier est intégralement dans src (sauf dossier src.features à ignorer).

Les modifications sont à apporter dans le fichier src/9_besoin_ch.js je pense

pertes_generateur_ch_recup_depensier:
this.pertesGenerateurChRecup(ctx, logement, true) / (1000 * 1000)
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, test, vi } from 'vitest';
import corpus from '../../../../../../test/corpus-sano.json';
import { expect_or, getAdemeFileJson } from '../../../../../../test/test-helpers.js';
import { getAdemeFileJson } from '../../../../../../test/test-helpers.js';
import { DpeNormalizerService } from '../../../../normalizer/domain/dpe-normalizer.service.js';
import { ContexteBuilder } from '../../contexte.builder.js';
import { FrTvStore } from '../../../../dpe/infrastructure/froid/frTv.store.js';
Expand Down Expand Up @@ -261,15 +261,8 @@ describe('Calcul des pertes de génération de chauffage récupérées', () => {
const expectedValue = dpeRequest.logement.sortie.apport_et_besoin.pertes_generateur_ch_recup;
const calculatedValue = pertesGeneration.pertes_generateur_ch_recup;

expect_or(
() =>
expect(Math.abs(calculatedValue - expectedValue) / (expectedValue || 1)).toBeLessThan(
PRECISION_PERCENT
),
() =>
expect(
Math.abs(calculatedValue - expectedValue * 1000) / (expectedValue * 1000 || 1)
).toBeLessThan(PRECISION_PERCENT)
expect(Math.abs(calculatedValue - expectedValue) / (expectedValue || 1)).toBeLessThan(
PRECISION_PERCENT
);
});

Expand Down Expand Up @@ -297,15 +290,8 @@ describe('Calcul des pertes de génération de chauffage récupérées', () => {
dpeRequest.logement.sortie.apport_et_besoin.pertes_generateur_ch_recup_depensier;
const calculatedValue = pertesGeneration.pertes_generateur_ch_recup_depensier;

expect_or(
() =>
expect(Math.abs(calculatedValue - expectedValue) / (expectedValue || 1)).toBeLessThan(
PRECISION_PERCENT
),
() =>
expect(
Math.abs(calculatedValue - expectedValue * 1000) / (expectedValue * 1000 || 1)
).toBeLessThan(PRECISION_PERCENT)
expect(Math.abs(calculatedValue - expectedValue) / (expectedValue || 1)).toBeLessThan(
PRECISION_PERCENT
);
}
);
Expand Down
3 changes: 2 additions & 1 deletion test/corpus.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,6 @@
"2159E1018555M",
"2269E1217015Z",
"2374E2700849T",
"2469E1924277L"
"2469E1924277L",
"2684E0017144V"
]
Loading
Loading