Skip to content
Snippets Groups Projects
Commit 8df48608 authored by David Dorchies's avatar David Dorchies :zany_face:
Browse files

Merge branch '355-cloisons-le-champ-cote-de-l-eau-amont-n-est-pas-vide-par-defaut' into 'devel'

Resolve "Cloisons: le champ "Cote de l'eau amont" n'est pas vide par défaut"

Closes #355

See merge request cassiopee/jalhyd!153
parents 867938cc 3ba2b1c9
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ stages:
- package
default:
tags: [docker]
tags: [mia3]
image: node:latest
......
......@@ -137,5 +137,20 @@ describe("Class Cloisons: ", () => {
expect(cloisons.structures[0].result.log.messages[1].code).toBe(MessageCode.WARNING_NEGATIVE_SILL);
});
});
describe("jalhyd#355", () => {
it("Z1 should be undefined when nullParams = true", () => {
const cl = new Cloisons(
new CloisonsParams(
1.5, // Débit total (m3/s)
102, // Cote de l'eau amont (m)
10, // Longueur des bassins (m)
1, // Largeur des bassins (m)
1, // Profondeur moyenne (m)
0.5, // Hauteur de chute (m)
true
)
);
expect(cl.prms.Z1.v).toBe(undefined);
});
});
});
......@@ -37,7 +37,7 @@ export class CloisonsParams extends ParallelStructureParams {
* @param rDH Hauteur de chute (m)
*/
constructor(rQ: number, rZ1: number, rLB: number, rBB: number, rPB: number, rDH: number, nullParams: boolean = false) {
super(rQ, rZ1, rZ1 - rDH);
super(rQ, rZ1, rZ1 - rDH, nullParams);
this.LB = new ParamDefinition(this, "LB", ParamDomainValue.POS, "m", rLB, ParamFamily.LENGTHS, undefined, nullParams);
this.addParamDefinition(this.LB);
this.BB = new ParamDefinition(this, "BB", ParamDomainValue.POS, "m", rBB, ParamFamily.WIDTHS, undefined, nullParams);
......
......@@ -105,10 +105,10 @@ export class ParamDefinition implements INamedIterableValues, IObservable {
private _observable: Observable;
/**
* @param ignoreValue true if provided value must be ignored (@see nghyd/enableEmptyFieldsOnFormInit)
* @param nullParams true if provided value must be ignored (@see nghyd/enableEmptyFieldsOnFormInit)
*/
constructor(parent: ParamsEquation, symb: string, d: ParamDomain | ParamDomainValue, unit?: string,
val?: number, family?: ParamFamily, visible: boolean = true, ignoreValue = false
val?: number, family?: ParamFamily, visible: boolean = true, nullParams = false
) {
this._parent = parent;
this._symbol = symb;
......@@ -117,13 +117,13 @@ export class ParamDefinition implements INamedIterableValues, IObservable {
this._paramValues = new ParamValues();
// set single value and copy it to sandbox value and initValue
if (!ignoreValue) {
if (!nullParams) {
this._paramValues.singleValue = val;
this.v = val;
}
this.initValue = val;
// if (!ignoreValue && this._paramValues.singleValue === undefined) {
// if (!nullParams && this._paramValues.singleValue === undefined) {
// throw new Error("a value must be provided for " + symb + " parameter");
// }
......
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