Commit 99420ba7 authored by Dorchies David's avatar Dorchies David
Browse files

Merge branch '470-prebarrage-calculable-avec-champs-vides1' into 'devel'

Resolve "Prebarrage: calculable avec champs vides"

See merge request !110
parents 99f3556c 32d82c7e
Pipeline #16125 passed with stages
in 41 minutes and 50 seconds
32-ajout-de-l-outil-prebarrage
278-prebarrage-calculable-avec-champs-vides-cassiopee-nghyd-470
......@@ -473,8 +473,9 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
this._isUIValid = false;
if (! this._formulaire.calculateDisabled) {
// all fieldsets must be valid
this._isUIValid = true;
if (this._fieldsetComponents !== undefined) {
this._isUIValid = this._fieldsetComponents.reduce(
this._isUIValid = this._isUIValid && this._fieldsetComponents.reduce(
// callback
(
// accumulator (valeur précédente du résultat)
......@@ -514,10 +515,13 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
if (this._pabTableComponent !== undefined) {
this._isUIValid = this._isUIValid && this._pabTableComponent.isValid;
}
}
if (this._pbSchemaComponent !== undefined) {
this._isUIValid = this._isUIValid && this._pbSchemaComponent.isValid;
if (this._pbSchemaComponent !== undefined) {
this._isUIValid = this._isUIValid && this._pbSchemaComponent.isValid;
}
if (this._formulaire.currentNub.calcType === CalculatorType.PreBarrage) {
const form: FormulairePrebarrage = this._formulaire as FormulairePrebarrage;
this._isUIValid = this._isUIValid && form.currentNub.check();
}
}
}
......
......@@ -55,7 +55,7 @@ export class FormulairePrebarrage extends FormulaireFixedVar {
public get results(): CalculatorResults[] {
// ensure help links are propagated
this._pbResults.helpLinks = this.helpLinks;
return [ this._pbResults ];
return [this._pbResults];
}
public get hasResults(): boolean {
......@@ -185,7 +185,7 @@ export class FormulairePrebarrage extends FormulaireFixedVar {
*/
private showFormElements(f: FormulaireDefinition) {
// clear all kids except PbSchema
this._kids = [ this.kids[0] ];
this._kids = [this.kids[0]];
for (const e of f.kids) {
this.kids.push(e);
}
......@@ -317,4 +317,19 @@ export class FormulairePrebarrage extends FormulaireFixedVar {
this.refreshSchema();
}
}
/**
* Set value of all single parameters to undefined, except for the given parameter ids
*/
public emptyFields(except: string[] = [ "Cd0", "CdWS", "CdGR", "CdGRS", "CdCunge", "CdWR", "CdO", "CdT", "CdWSL" ]) {
// save current calculated param, as setting value on a CALC param will
// change its mode and choose another calculated param by default
const paramCalculated = this.currentNub.calculatedParam;
for (const p of this.currentNub.parameterIterator) {
if (! except.includes(p.symbol)) {
p.setValue(undefined);
}
}
this.currentNub.calculatedParam = paramCalculated;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment