diff --git a/src/app/components/fixedvar-results/fixed-results.component.ts b/src/app/components/fixedvar-results/fixed-results.component.ts index afb476e039e2c5345f10ddb323953ebd24468d03..32660b36862b5b0c3650fc5b133a0be1535743fd 100644 --- a/src/app/components/fixedvar-results/fixed-results.component.ts +++ b/src/app/components/fixedvar-results/fixed-results.component.ts @@ -89,31 +89,11 @@ export class FixedResultsComponent extends ResultsComponentDirective { */ protected buildCustomOrderedDataset() { const data = []; - for (const symbol of this._fixedResults.variablesOrder) { - - // is it a fixed parameter ? - for (const fp of this.fixedParams) { - if (fp.symbol === symbol) { - let label = this.formattedLabel(fp); - const nub = fp.paramDefinition.parentNub; - // add child type and position before label - if (nub && nub.parent && nub.parent.childrenType) { - const pos = nub.findPositionInParent(); - // label = this.intlService.localizeText("INFO_OUVRAGE") + " n°" + (pos + 1) + ": " + label; - const cn = capitalize(this.intlService.childName(nub.parent)); - label = sprintf(this.intlService.localizeText("INFO_STUFF_N"), cn) - + (pos + 1) + ": " + label; - } - label += this._fixedResults.getHelpLink(symbol); - data.push({ - label: label, - value: this.formattedValue(fp), - isCalcResult: false // for CSS - }); - } - } + let resultFound: boolean; - // is it a result or child result ?const res = this._fixedResults.result; + for (const symbol of this._fixedResults.variablesOrder) { + resultFound = false; + // 1) is it a result or child result ? const res = this._fixedResults.result; if ( res @@ -152,12 +132,14 @@ export class FixedResultsComponent extends ResultsComponentDirective { } } + resultFound = found; // 2.2. children results if (! found) { for (const c of sn.getChildren()) { if (c.result) { for (const k of c.result.resultElement.keys) { if (k === symbol) { + resultFound = true; const er: number = c.result.resultElement.getValue(k); // calculator type for translation let ct = sn.calcType; @@ -180,6 +162,30 @@ export class FixedResultsComponent extends ResultsComponentDirective { } } } + + // 2) else, is it a fixed parameter ? + if (! resultFound) { + for (const fp of this.fixedParams) { + if (fp.symbol === symbol) { + let label = this.formattedLabel(fp); + const nub = fp.paramDefinition.parentNub; + // add child type and position before label + if (nub && nub.parent && nub.parent.childrenType) { + const pos = nub.findPositionInParent(); + // label = this.intlService.localizeText("INFO_OUVRAGE") + " n°" + (pos + 1) + ": " + label; + const cn = capitalize(this.intlService.childName(nub.parent)); + label = sprintf(this.intlService.localizeText("INFO_STUFF_N"), cn) + + (pos + 1) + ": " + label; + } + label += this._fixedResults.getHelpLink(symbol); + data.push({ + label: label, + value: this.formattedValue(fp), + isCalcResult: false // for CSS + }); + } + } + } } return data; } diff --git a/src/app/formulaire/definition/form-par.ts b/src/app/formulaire/definition/form-par.ts new file mode 100644 index 0000000000000000000000000000000000000000..96dddf2c77d3eb61c0326aa66636e9d569c1c58c --- /dev/null +++ b/src/app/formulaire/definition/form-par.ts @@ -0,0 +1,18 @@ +import { FormulaireFixedVar } from "./form-fixedvar"; + +/** + * Formulaire pour les PAR Calage + */ +export class FormulairePAR extends FormulaireFixedVar { + + constructor() { + super(); + // custom variables order for results tables + this.fixedResults.variablesOrder = [ + "Q", "Z1", "Z2", "ha", "S", "L", "a", "N", "M", + "h", "qStar", "V", "ZD1", "ZR1", "ZD2", "ZR2", "P", "Nb", "LPI", "LPH", + "A", "B", "C", "D", "H", "Hmin", "Hmax", "ZM" + ]; + } + +} diff --git a/src/app/services/formulaire.service.ts b/src/app/services/formulaire.service.ts index 101572ca12f6d88a4cc3658d284cf375357e3f4b..cd8b20b3ffdab0d621ecfe5b18d4a5a3fc809537 100644 --- a/src/app/services/formulaire.service.ts +++ b/src/app/services/formulaire.service.ts @@ -40,6 +40,7 @@ import { AppComponent } from "../app.component"; import { FormulaireSPP } from "../formulaire/definition/form-spp"; import { FormulaireFixedVar } from "../formulaire/definition/form-fixedvar"; import { FormulaireSection } from "../formulaire/definition/form-section"; +import { FormulairePAR } from "../formulaire/definition/form-par"; @Injectable() export class FormulaireService extends Observable { @@ -299,6 +300,11 @@ export class FormulaireService extends Observable { f = new FormulaireGrille(); break; + case CalculatorType.Par: + case CalculatorType.ParSimulation: + f = new FormulairePAR(); + break; + case CalculatorType.Solveur: f = new FormulaireSolveur(); break;