From cac551a6993b05300fbdea4540da5441e0ce34c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr> Date: Tue, 28 Mar 2023 14:06:24 +0200 Subject: [PATCH] fix: MacroRugoRemous form: restore section generation select, fix NaNs refs #609 --- .../components/generic-calculator/calculator.component.ts | 5 ++--- src/app/formulaire/definition/form-macrorugo-remous.ts | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/components/generic-calculator/calculator.component.ts b/src/app/components/generic-calculator/calculator.component.ts index 18955e18d..7c249e932 100644 --- a/src/app/components/generic-calculator/calculator.component.ts +++ b/src/app/components/generic-calculator/calculator.component.ts @@ -742,7 +742,7 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe // true if CourbeRemous results are present public get hasCourbeRemousResults() { - return this.is(CalculatorType.CourbeRemous) && this.hasResults; + return (this.is(CalculatorType.CourbeRemous) || this.is(CalculatorType.MacroRugoRemous)) && this.hasResults; } // true if current Nub is PAR @@ -1012,8 +1012,7 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe */ public get courbeRemousPoints(): any[] { if (this.hasCourbeRemousResults) { - const crForm = this._formulaire as FormulaireCourbeRemous; - for (const r of crForm.results) { + for (const r of this._formulaire.results) { if (r instanceof RemousResults) { return r.points; } diff --git a/src/app/formulaire/definition/form-macrorugo-remous.ts b/src/app/formulaire/definition/form-macrorugo-remous.ts index fffac2f9a..ab26cd956 100644 --- a/src/app/formulaire/definition/form-macrorugo-remous.ts +++ b/src/app/formulaire/definition/form-macrorugo-remous.ts @@ -40,6 +40,7 @@ export class FormulaireMacroRugoRemous extends FormulaireFixedVar { protected reaffectResultComponents() { const mrr = this.currentNub as MacroRugoRemous; + mrr.syncSectionMacroRugo(); // variable supplémentaire à calculer this._remousResults.extraParamSymbol = mrr.getPropValue("varCalc"); @@ -50,6 +51,9 @@ export class FormulaireMacroRugoRemous extends FormulaireFixedVar { const prmMRR = mrr.prms as MacroRugoRemousParams; this._remousResults.parameters = prmMRR; + // calcul + this._remousResults.result = mrr.CalcSerie(); + const sect: acSection = mrr.Sn; this.resultYn = sect.CalcSection("Yn"); // hauteur normale this.resultYc = sect.CalcSection("Yc"); // hauteur critique -- GitLab