Skip to content
Snippets Groups Projects
Commit 4a8ed8bc authored by mathias.chouet's avatar mathias.chouet
Browse files

Adaptation à JaLHyd : properly separating singleValue and currentValue concepts

Panneau des résultats fixés: protection contre un résultat vide
Mode calcul : protection contre valeur non définie
parent b9dfd2ba
No related branches found
No related tags found
1 merge request!45Resolve "Ajout du module de calcul d'une passe à bassins"
......@@ -84,6 +84,7 @@ export class FixedResultsComponent {
const res = this._fixedResults.result;
if (
res
&& res.nbResultElements > 0
&& res.resultElement
&& res.extraResults
) {
......
......@@ -47,9 +47,7 @@ export class NgParamInputComponent extends GenericInputComponent implements Obse
*/
protected afterSetModel() {
if (this._paramDef) {
if (this._paramDef.isDefined) {
this._tmp = this._paramDef.getValue();
}
this._tmp = this._paramDef.getValue();
this._paramDef.addObserver(this);
}
}
......
......@@ -208,9 +208,6 @@ export class ParamFieldLineComponent implements OnChanges {
switch (option) {
case "fix":
this.param.valueMode = ParamValueMode.SINGLE;
// reset the value to avoid "undefined" after exiting CALC or LINK mode
// @TODO not always necessary; find out why
this.param.setValue(this, this.param.paramDefinition.singleValue);
break;
case "var":
......
......@@ -43,9 +43,8 @@ export abstract class FormCompute implements Observer {
computedParam = nub.calculatedParam;
}
// require chain computation; redundant with Nub.CalcSerie but required
// to get initial value here...
const computedParamValue = computedParam.getValue();
// const computedParamValue = computedParam.getValue();
const computedParamValue = computedParam.singleValue;
switch (computedParam.domain.domain) {
case ParamDomainValue.ANY:
......
......@@ -266,11 +266,16 @@ export class NgParameter extends InputField implements Observer {
}
/**
* Asks the ParamDefinition for its current value
* @TODO replace with singleValue to avoid displaying computation results ?
* Asks the ParamDefinition for its singleValue (not currentValue,
* to avoid displaying computation results); calculated linked
* value might not be available yet
*/
public getValue() {
return this._paramDef.getValue();
try {
return this._paramDef.getValue();
} catch (error) {
return undefined;
}
}
/**
......
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