From ea9b4d1292fdf2f75719c14d26a4e0c8e9518673 Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Wed, 20 Nov 2019 12:02:44 +0100 Subject: [PATCH] MacrorugoCompound and PAB: fix bug in variable selector index when switching from variable mode to fixed mode --- .../formulaire/definition/form-compute-macrorugo-compound.ts | 4 ++++ src/app/formulaire/definition/form-compute-pab.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/app/formulaire/definition/form-compute-macrorugo-compound.ts b/src/app/formulaire/definition/form-compute-macrorugo-compound.ts index a713e933e..6f2b4c303 100644 --- a/src/app/formulaire/definition/form-compute-macrorugo-compound.ts +++ b/src/app/formulaire/definition/form-compute-macrorugo-compound.ts @@ -17,6 +17,10 @@ export class FormComputeMacrorugoCompound extends FormCompute { protected compute() { this.runNubCalc(this._formBase.currentNub); + // reset variable index to avoid trying to access an index > 0 when nothing varies + const mrcr = this.formResult.mrcResults; + mrcr.variableIndex = 0; + this.reaffectResultComponents(); } diff --git a/src/app/formulaire/definition/form-compute-pab.ts b/src/app/formulaire/definition/form-compute-pab.ts index 13e0a0ea3..2f10d0f51 100644 --- a/src/app/formulaire/definition/form-compute-pab.ts +++ b/src/app/formulaire/definition/form-compute-pab.ts @@ -17,6 +17,10 @@ export class FormComputePab extends FormCompute { protected compute() { this.runNubCalc(this._formBase.currentNub); + // reset variable index to avoid trying to access an index > 0 when nothing varies + const pabr = this.formResult.pabResults; + pabr.variableIndex = 0; + this.reaffectResultComponents(); } -- GitLab