From 7742a202e9a99565778187c68c6eb29dc9ea58bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr> Date: Thu, 2 Feb 2023 10:25:31 +0100 Subject: [PATCH] fix: pressure loss results: do not display child rank for results from child law nub refs #585 --- .../fixed-results.component.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/app/components/fixedvar-results/fixed-results.component.ts b/src/app/components/fixedvar-results/fixed-results.component.ts index ae76c3e19..5905c6bce 100644 --- a/src/app/components/fixedvar-results/fixed-results.component.ts +++ b/src/app/components/fixedvar-results/fixed-results.component.ts @@ -10,6 +10,7 @@ import { NgParameter } from "../../formulaire/elements/ngparam"; import { capitalize, Result, ResultElement } from "jalhyd"; import { sprintf } from "sprintf-js"; +import { PressureLoss } from "jalhyd"; @Component({ selector: "fixed-results", @@ -256,10 +257,20 @@ export class FixedResultsComponent extends ResultsComponentDirective { if (sn.parent) { ct = sn.parent.calcType; } - const cn = capitalize(this.intlService.childName(c)); - let label = sprintf(this.intlService.localizeText("INFO_STUFF_N"), cn) - + (c.findPositionInParent() + 1) + " : " - + this.formService.expandVariableNameAndUnit(ct, k); + + // do not display child rank in case of pressure loss law + const displayChildRank = !(sn instanceof PressureLoss); + let label: string; + if (displayChildRank) { + const cn = capitalize(this.intlService.childName(c)); + label = sprintf(this.intlService.localizeText("INFO_STUFF_N"), cn) + (c.findPositionInParent() + 1); + } + else { + label = capitalize(this.intlService.childName(c)); + } + + label += " : "; + label += this.formService.expandVariableNameAndUnit(ct, k); label += this._fixedResults.getHelpLink(k); data.push({ label: label, -- GitLab