Skip to content
Snippets Groups Projects
Commit 63d385ca authored by François Grand's avatar François Grand
Browse files

fix: pressure loss form: create child law nub when opening calculator

refs #592
parent 047ce4c0
No related branches found
No related tags found
2 merge requests!225Release v4.17.0,!199Resolve "Incohérence dans les fichiers de session"
import { PressureLoss, Props, PressureLossType } from "jalhyd";
import { PressureLoss, Props, PressureLossType, Session, PressureLossLaw, CalculatorType } from "jalhyd";
import { FormulaireFixedVar } from "./form-fixedvar";
/**
......@@ -17,8 +17,19 @@ export class FormulairePressureLoss extends FormulaireFixedVar {
if (props === undefined) {
props = new Props();
}
// create pressure loss parent nub
const pll = this.defaultProperties["pressureLossType"];
props.setPropValue("calcType", this.calculatorType);
props.setPropValue("pressureLossType", this.defaultProperties["pressureLossType"]);
props.setPropValue("pressureLossType", pll);
super.initNub(props);
// create pressure loss law child nub
const propsLaw: Props = new Props();
const pressureLossCalc: CalculatorType = PressureLossLaw.calcTypeFromPressureLossLaw[pll];
propsLaw.setPropValue("calcType", pressureLossCalc);
const law = Session.getInstance().createNub(propsLaw) as PressureLossLaw;
const pl: PressureLoss = this.currentNub as PressureLoss;
pl.setLaw(law);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment