diff --git a/e2e/calculator.po.ts b/e2e/calculator.po.ts index a3e578709bc86a9505ccb1158804f135d02faf5b..d24ffd1575d406ba513c854e15a7836e7a6b6d50 100644 --- a/e2e/calculator.po.ts +++ b/e2e/calculator.po.ts @@ -91,6 +91,8 @@ export class CalculatorPage { await element(by.css("fixedvar-results fixed-results > .fixed-results-container")).isPresent() || await element(by.css("fixedvar-results results-graph > graph-results-container")).isPresent() + || + await element(by.css("pab-results pab-results-table")).isPresent() ); } diff --git a/e2e/clone-all-calc.e2e-spec.ts b/e2e/clone-all-calc.e2e-spec.ts index a6e46288c8198291e0bd055a3e0b62f8d25da2ad..1cf0a8d470e2ec2e4a1de4c20190408c165ebbe5 100644 --- a/e2e/clone-all-calc.e2e-spec.ts +++ b/e2e/clone-all-calc.e2e-spec.ts @@ -48,7 +48,9 @@ describe("ngHyd − clone all calculators with all possible <select> values", () // read all <input> values and compare them to stored ones const cloneValues = await calcPage.storeAllInputValues(); - expect(cloneValues).toEqual(sourceValues); + for (const k in cloneValues) { + expect(cloneValues[k]).toBeCloseTo(sourceValues[k]); + } }); }); } diff --git a/e2e/pab.e2e-spec.ts b/e2e/pab.e2e-spec.ts index 8d06db122cdd4a7acc2a0cfeecf3b063d81190a8..5377303ba29c58143d78c13548c3b97935da5d7c 100644 --- a/e2e/pab.e2e-spec.ts +++ b/e2e/pab.e2e-spec.ts @@ -25,49 +25,13 @@ describe("ngHyd − Passe à Bassins", () => { describe("create PAB - ", async () => { - it("when PAB is created after Cloisons & ParallelStructure", async() => { - // create Cloisons - await startPage.navigateTo(); - await listPage.clickMenuEntryForCalcType(10); - // create ParallelStructure - await navbar.clickNewCalculatorButton(); - await listPage.clickMenuEntryForCalcType(8); - // create PAB - await navbar.clickNewCalculatorButton(); - await listPage.clickMenuEntryForCalcType(15); - // check number of basins - const innerFieldsets = element.all(by.css(".fieldset-inner")); - expect(await innerFieldsets.count()).toBe(1); - // check <select> value - const smc = calcPage.getSelectById("select_modele_cloisons"); - const v = await calcPage.getSelectValueText(smc); - expect(v).toEqual("Cloisons"); - // check downstream wall - const smca = calcPage.getSelectById("select_modele_cloison_aval"); - expect(await calcPage.getSelectValueText(smca)).toEqual("Ouvrages"); - }); - - it("when PAB is created before Cloisons & ParallelStructure", async() => { + it("when PAB is created from scratch", async() => { // create PAB await startPage.navigateTo(); await listPage.clickMenuEntryForCalcType(15); - // create Cloisons - await navbar.clickNewCalculatorButton(); - await listPage.clickMenuEntryForCalcType(10); - // create ParallelStructure - await navbar.clickNewCalculatorButton(); - await listPage.clickMenuEntryForCalcType(8); - // check number of basins - await navbar.clickCalculatorTab(0); - const innerFieldsets = element.all(by.css(".fieldset-inner")); + // check that pab-table is present + const innerFieldsets = element.all(by.css(".pab-data-table")); expect(await innerFieldsets.count()).toBe(1); - // check <select> value - const smc = calcPage.getSelectById("select_modele_cloisons"); - const v = await calcPage.getSelectValueText(smc); - expect(v).toEqual("Cloisons"); - // check downstream wall - const smca = calcPage.getSelectById("select_modele_cloison_aval"); - expect(await calcPage.getSelectValueText(smca)).toEqual("Ouvrages"); }); }); @@ -93,12 +57,14 @@ describe("ngHyd − Passe à Bassins", () => { const DH = calcPage.getInputById("DH"); await DH.clear(); await DH.sendKeys("0.72"); + // create PAB from it, changing modal parameters const genButton = calcPage.getGeneratePabButton(); await genButton.click(); const debit = calcPage.getInputById("generatePabDebit"); expect(await debit.getAttribute("value")).toBe("1.5"); await debit.clear(); + await browser.sleep(300); // send "1.6" in 3 movements, because "." triggers an error and Angular can't cope with the subsequent keys await debit.sendKeys("1"); await browser.sleep(300); @@ -114,22 +80,22 @@ describe("ngHyd − Passe à Bassins", () => { expect(await nbBassins.getAttribute("value")).toBe("6"); await nbBassins.clear(); await nbBassins.sendKeys("5"); + // click "Generate" await element(by.css("dialog-generate-pab button#do-generate")).click(); await browser.sleep(1000); + // check parameters values const P_Q = calcPage.getInputById("Q"); expect(await P_Q.getAttribute("value")).toBe("1.6"); const P_Z2 = calcPage.getInputById("Z2"); expect(await P_Z2.getAttribute("value")).toBe("111.4"); + // check number of basins - const innerFieldsets = element.all(by.css(".fieldset-inner")); + const innerFieldsets = element.all(by.css("td.basin_number")); expect(await innerFieldsets.count()).toBe(5); - // check <select> values - innerFieldsets.each(async (inf) => { - const smc = inf.element(by.css("mat-select#select_modele_cloisons")); - expect(await calcPage.getSelectValueText(smc)).toEqual("Cloisons 1"); - }); + + // @TODO check more stuff }); }); @@ -173,88 +139,6 @@ describe("ngHyd − Passe à Bassins", () => { expect(await calcPage.getSelectValueText(smca)).toEqual("Ouvrages 1"); }); - it("when PAB is loaded before Cloisons & ParallelStructure", async() => { - await startPage.navigateTo(); - // load - await navbar.clickMenuButton(); - await browser.sleep(200); - await sidenav.clickLoadSessionButton(); - await browser.sleep(200); - await sidenav.loadSessionFile("./session-pab-mauvais-ordre.json"); - await browser.sleep(500); - // check existence of the loaded modules - expect(await navbar.getAllCalculatorTabs().count()).toBe(6); - // check parameters values - await navbar.clickCalculatorTab(0); - await browser.sleep(200); - const P_Q = calcPage.getInputById("Q"); - expect(await P_Q.getAttribute("value")).toBe("1.533"); - const P_Z2 = calcPage.getInputById("Z2"); - expect(await P_Z2.getAttribute("value")).toBe("99.44"); - // check number of basins - const innerFieldsets = element.all(by.css(".fieldset-inner")); - expect(await innerFieldsets.count()).toBe(5); - // check <select> values - const expectedCloisons = [ "Cloisons 1", "Cloisons 2", "Cloisons", "Cloisons 2", "Cloisons 1" ]; - const expectedQA = [ 2, 1, 3, 5, 4 ]; - let i = 0; - for (let i = 0; i < innerFieldsets.length; i++) { - const inf = innerFieldsets[i]; - const smc = inf.element(by.css("mat-select#select_modele_cloisons")); - expect(await calcPage.getSelectValueText(smc)).toEqual(expectedCloisons[i]); - const QA = inf.element(by.css("input[id$=QA]")); - expect(Number(await QA.getAttribute("value"))).toBe(expectedQA[i]); - i++; - } - // check downstream wall - const smca = calcPage.getSelectById("select_modele_cloison_aval"); - expect(await calcPage.getSelectValueText(smca)).toEqual("Ouvrages 1"); - }); - - it("when PAB is loaded without Cloisons & ParallelStructure", async() => { - await startPage.navigateTo(); - // load - await navbar.clickMenuButton(); - await browser.sleep(200); - await sidenav.clickLoadSessionButton(); - await browser.sleep(200); - await sidenav.loadSessionFile("./session-pab-modeles-vides.json"); - await browser.sleep(500); - - // check existence of the loaded modules - expect(await navbar.getAllCalculatorTabs().count()).toBe(1); - // check number of basins - await navbar.clickCalculatorTab(0); - await browser.sleep(200); - const innerFieldsets = element.all(by.css(".fieldset-inner")); - expect(await innerFieldsets.count()).toBe(3); - // check empty <select> - innerFieldsets.each(async (inf) => { - const smc = inf.element(by.css("mat-select#select_modele_cloisons")); - const smcEmpty = await calcPage.isSelectEmpty(smc); - console.log("SMC EMPTY ?", smcEmpty); - expect(smcEmpty).toBe(true); - }); - // check empty <select> for downstream wall - const smca = calcPage.getSelectById("select_modele_cloison_aval"); - expect(await calcPage.isSelectEmpty(smca)).toBe(true); - - // create a Cloisons - await navbar.clickNewCalculatorButton(); - await listPage.clickMenuEntryForCalcType(10); - // create a ParallelStructure - await navbar.clickNewCalculatorButton(); - await listPage.clickMenuEntryForCalcType(8); - // check that they are selected - await navbar.clickCalculatorTab(0); - innerFieldsets.each(async (inf) => { - const smc = inf.element(by.css("mat-select#select_modele_cloisons")); - expect(await calcPage.getSelectValueText(smc)).toEqual("Cloisons"); - }); - const smca2 = calcPage.getSelectById("select_modele_cloison_aval"); - expect(await calcPage.getSelectValueText(smca2)).toEqual("Ouvrages"); - }); - }); }); diff --git a/e2e/session-pab-mauvais-ordre.json b/e2e/session-pab-mauvais-ordre.json index c60b52be8d02bf622573c496d7418831293068ec..998442a72d483b9073bed566ec92cd4dc8fa3876 100644 --- a/e2e/session-pab-mauvais-ordre.json +++ b/e2e/session-pab-mauvais-ordre.json @@ -9,8 +9,7 @@ "uid": "NXd0dH", "props": { "calcType": 15, - "nodeType": 0, - "modeleCloisonAval": "eWtnaj" + "nodeType": 0 }, "meta": { "title": "PAB" @@ -20,8 +19,7 @@ "uid": "bWswdD", "props": { "calcType": 16, - "nodeType": 0, - "modeleCloisons": "bTkxem" + "nodeType": 0 }, "parameters": [ { @@ -35,8 +33,7 @@ "uid": "am1oNz", "props": { "calcType": 16, - "nodeType": 0, - "modeleCloisons": "bnNhen" + "nodeType": 0 }, "parameters": [ { @@ -50,8 +47,7 @@ "uid": "cWJrZm", "props": { "calcType": 16, - "nodeType": 0, - "modeleCloisons": "amp6N2" + "nodeType": 0 }, "parameters": [ { @@ -65,8 +61,7 @@ "uid": "Y25nNn", "props": { "calcType": 16, - "nodeType": 0, - "modeleCloisons": "bnNhen" + "nodeType": 0 }, "parameters": [ { @@ -80,8 +75,7 @@ "uid": "M2gxaX", "props": { "calcType": 16, - "nodeType": 0, - "modeleCloisons": "bTkxem" + "nodeType": 0 }, "parameters": [ { diff --git a/e2e/session-pab.json b/e2e/session-pab.json index 2d00f2eecf74e85ef506b780ebd21131e5a7792e..11cc43baaa316f350fdf40075d0b0a96e8e555bd 100644 --- a/e2e/session-pab.json +++ b/e2e/session-pab.json @@ -349,8 +349,7 @@ "uid": "NXd0dH", "props": { "calcType": 15, - "nodeType": 0, - "modeleCloisonAval": "eWtnaj" + "nodeType": 0 }, "meta": { "title": "PAB" @@ -360,8 +359,7 @@ "uid": "bWswdD", "props": { "calcType": 16, - "nodeType": 0, - "modeleCloisons": "bTkxem" + "nodeType": 0 }, "parameters": [ { @@ -375,8 +373,7 @@ "uid": "am1oNz", "props": { "calcType": 16, - "nodeType": 0, - "modeleCloisons": "bnNhen" + "nodeType": 0 }, "parameters": [ { @@ -390,8 +387,7 @@ "uid": "cWJrZm", "props": { "calcType": 16, - "nodeType": 0, - "modeleCloisons": "amp6N2" + "nodeType": 0 }, "parameters": [ { @@ -405,8 +401,7 @@ "uid": "Y25nNn", "props": { "calcType": 16, - "nodeType": 0, - "modeleCloisons": "bnNhen" + "nodeType": 0 }, "parameters": [ { @@ -420,8 +415,7 @@ "uid": "M2gxaX", "props": { "calcType": 16, - "nodeType": 0, - "modeleCloisons": "bTkxem" + "nodeType": 0 }, "parameters": [ { diff --git a/src/app/components/dialog-save-session/dialog-save-session.component.ts b/src/app/components/dialog-save-session/dialog-save-session.component.ts index eac698d910b693c0bda270014b765531b4506702..425c5f5ed09046dde490187c875df3adb51d85f3 100644 --- a/src/app/components/dialog-save-session/dialog-save-session.component.ts +++ b/src/app/components/dialog-save-session/dialog-save-session.component.ts @@ -47,7 +47,6 @@ export class DialogSaveSessionComponent { * - PabCloisons depend on their models */ public checkLinkedParamsAndModelsDependencies() { - console.log("CLPMD !", this.calculators); this.dependenciesProblems = []; // for all checked Nubs this.calculators.forEach((c) => { diff --git a/src/app/components/field-set/field-set.component.html b/src/app/components/field-set/field-set.component.html index 2471c8dcb4c729e487c16c8e1b9ed2c3f6de27d7..708b04ad6a322a05841b1f4e1e2199e88900fe41 100644 --- a/src/app/components/field-set/field-set.component.html +++ b/src/app/components/field-set/field-set.component.html @@ -35,8 +35,5 @@ <select-field-line *ngIf="isSelectField(p)" [_select]=p> </select-field-line> - - <select-model-field-line *ngIf="isSelectModelField(p)" [_select]=p> - </select-model-field-line> </ng-template> </mat-card-content> diff --git a/src/app/components/field-set/field-set.component.ts b/src/app/components/field-set/field-set.component.ts index 74655a86a74bb196f3b69160b5d8f7baa8eb9381..d26f1e0048abe33f0f47a8eee5966ca15624b771 100644 --- a/src/app/components/field-set/field-set.component.ts +++ b/src/app/components/field-set/field-set.component.ts @@ -207,21 +207,6 @@ export class FieldSetComponent implements DoCheck { ); } - /** - * détermine si un Field est du type SelectFieldModel - */ - private isSelectModelField(f: Field): boolean { - /* return ( - f instanceof SelectFieldModel - && f.parentForm instanceof FormulairePab - && ( - f.id === (f.parentForm as FormulairePab).modeleCloisonsSelectId - || f.id === (f.parentForm as FormulairePab).modeleCloisonAvalSelectId - ) - ); */ - return false; // tmp patch - } - /* * gestion des événements clic sur les radios : * réception d'un message du composant enfant (param-field) diff --git a/src/app/components/pab-results/pab-results-table.component.ts b/src/app/components/pab-results/pab-results-table.component.ts index ac9fda71dfcedbc98c3c99f974fcfffcc91aa208..959e2a8483e22ad7f44ae12a2d632e1a58a96ca5 100644 --- a/src/app/components/pab-results/pab-results-table.component.ts +++ b/src/app/components/pab-results/pab-results-table.component.ts @@ -53,7 +53,7 @@ export class PabResultsTableComponent extends ResultsComponent { // line 1 if (pr.cloisonsResults[0].vCalc) { // parfois le calcul des cloisons échoue this._dataSet.push([ - "", + this.intlService.localizeText("INFO_LIB_AMONT"), pr.cloisonsResults[0] ? pr.cloisonsResults[0].vCalc.toFixed(nDigits) : "", "", "", "", "", "", "", "" ]); @@ -89,7 +89,7 @@ export class PabResultsTableComponent extends ResultsComponent { if (pr.cloisonAvalResults.vCalc) { const rln = pr.cloisonAvalResults.resultElement.extraResults; this._dataSet.push([ - this.intlService.localizeText("INFO_LIB_AVAL"), // n° cloison + this.intlService.localizeText("INFO_LIB_AVAL"), pr.Z2.toFixed(nDigits), rln.ZRAM.toFixed(nDigits), rln.DH.toFixed(nDigits), diff --git a/src/app/components/pab-results/pab-results.component.html b/src/app/components/pab-results/pab-results.component.html index 9fcc9927cd0a5b351b994c0585577205d89f36ce..ed25a06e7ac6e4fba7d0ca2516f41b830e733603 100644 --- a/src/app/components/pab-results/pab-results.component.html +++ b/src/app/components/pab-results/pab-results.component.html @@ -2,10 +2,10 @@ <!-- journal --> <log></log> - <results-graph *ngIf="hasResults"></results-graph> - <div> <!-- tableau de résultats --> <pab-results-table [results]="pabResults"></pab-results-table> </div> + + <results-graph *ngIf="hasResults"></results-graph> </div> diff --git a/src/app/formulaire/definition/concrete/form-pab.ts b/src/app/formulaire/definition/concrete/form-pab.ts index 22371ff1c7f62c79cd7b9572cbdb1be8aaf8cee6..b9407cdf4875475777837fcdbff163b83ad7fab3 100644 --- a/src/app/formulaire/definition/concrete/form-pab.ts +++ b/src/app/formulaire/definition/concrete/form-pab.ts @@ -10,12 +10,6 @@ import { FormResultPab } from "../form-result-pab"; */ export class FormulairePab extends FormulaireBase { - /** id du select configurant le modèle de cloisons */ - // private _modeleCloisonsSelectId: string; - - /** id du select configurant le modèle de la cloison aval */ - // private _modeleCloisonAvalSelectId: string; - constructor() { super(); this._formResult = new FormResultPab(this); @@ -34,200 +28,12 @@ export class FormulairePab extends FormulaireBase { super.doCompute(); } - /* public get modeleCloisonsSelectId(): string { - return this._modeleCloisonsSelectId; - } - - public get modeleCloisonAvalSelectId(): string { - return this._modeleCloisonAvalSelectId; - } */ - - /** - * Creates a virgin PabCloisons when a new fieldset is added through the GUI, - * to ensure consistency; this object is not related to any Cloisons - */ - /* private createDummyPabCloisons(templ: FieldsetTemplate): Nub { - const params = {}; - params["calcType"] = templ.calcTypeFromConfig; - return this.createBassin(new Props(params)); - } */ - - /** - * ajoute un Nub PabCloisons - * @param after position après laquelle insérer la structure, à la fin sinon - */ - /* private addPabCloisons(st: PabCloisons, after?: number) { - this.pabNub.addChild(st, after); - } */ - - /** - * Asks JaLHyd to create a PabCloisons Nub as a child of the current Calculator Module - * and return it; does not store it in the Session (for PabCloisons, not for Calculator Modules) - * @param p properties for the new Nub - */ - /* protected createBassin(p: Props): PabCloisons { - return Session.getInstance().createNub(p, this.currentNub as Pab) as PabCloisons; - } */ - - /** - * Replaces the current Nub in the current calculator module, with a new one built with properties "params" - * @param params properties to build the new Nub (calcType, loiDebit...) - */ - /* protected replaceNub(sn: PabCloisons, params: Props): Nub { - const parent = (this.currentNub as Pab); - const newBassin = this.createBassin(params); - parent.replaceChildInplace(sn, newBassin); - return newBassin; - } */ - - /** - * Deleted the given child Nub in the current calculator module - * @param params properties to build the new Nub (calcType, loiDebit...) - */ - /* protected deleteNub(sn: PabCloisons) { - const parent = (this.currentNub as PabCloisons); - parent.deleteChild(parent.getIndexForChild(sn)); - } */ - /* public createFieldset(parent: FormulaireNode, json: {}, data?: {}, nub?: Nub): FieldSet { - if (json["calcType"] === "PabCloisons") { - // indice après lequel insérer le nouveau FieldSet - const after = data["after"]; - - const res: FieldSet = new FieldSet(parent); - let n: Nub; - if (nub) { // use existing Nub (build interface based on model) - n = nub; - } else { - n = this.createDummyPabCloisons(data["template"]); - this.addPabCloisons(n as PabCloisons, after); - } - res.setNub(n, false); - - if (after !== undefined) { - parent.kids.splice(after + 1, 0, res); - } else { - parent.kids.push(res); - } - - this.resetResults(); - - return res; - } else { - return super.createFieldset(parent, json, data); - } - } */ - - /* protected parseOptions(json: {}) { - super.parseOptions(json); - // id du select configurant les modèles de cloisons - this._modeleCloisonsSelectId = this.getOption(json, "modeleCloisonsSelectId"); - // id du select configurant le modèle de cloison aval - this._modeleCloisonAvalSelectId = this.getOption(json, "modeleCloisonAvalSelectId"); - } */ - - /* public afterParseFieldset(fs: FieldSet) { - // si le FieldSet contient le select de modèles de cloisons - if (this._modeleCloisonsSelectId) { - const node = fs.getFormulaireNodeById(this._modeleCloisonsSelectId); - const sel = (node as SelectField); - if (sel) { - // on abonne le formulaire aux propriétés du FieldSet - fs.properties.addObserver(this); - } - } - // si le FieldSet contient le select du modèle de la cloison aval - if (this._modeleCloisonAvalSelectId) { - const node = fs.getFormulaireNodeById(this._modeleCloisonAvalSelectId); - const sel = (node as SelectField); - if (sel) { - // on abonne le formulaire aux propriétés du FieldSet - fs.properties.addObserver(this); - } - } - } */ - - /* protected completeParse(json: {}) { - this.subscribeFieldsetContainer(); - } */ - - /* private get fieldsetContainer(): FieldsetContainer { - const n = this.getFormulaireNodeById("bassin_container"); - if (n === undefined || !(n instanceof FieldsetContainer)) { - throw new Error("l'élément 'bassin_container' n'est pas du type FieldsetContainer"); - } - return n as FieldsetContainer; - } */ - - /** - * abonnement en tant qu'observateur du FieldsetContainer - */ - /* private subscribeFieldsetContainer() { - this.fieldsetContainer.addObserver(this); - } */ - - /** - * abonnement en tant qu'observateur des NgParameter des FieldSet contenus dans le FieldsetContainer - */ - /* private subscribeBasinFields(fs: FieldSet) { - for (const n of fs.allFormElements) { - if (n instanceof NgParameter || n instanceof SelectField) { - n.addObserver(this); - } - } - } */ - - // interface Observer - - /* public update(sender: any, data: any) { - - super.update(sender, data); - - if (sender instanceof FieldsetContainer) { - switch (data.action) { - case "newFieldset": - this.reset(); - this.subscribeBasinFields(data["fieldset"]); - } - } else if (sender instanceof FieldSet && data.action === "propertyChange") { - switch (sender.id) { - case "fs_bassin": - switch (data.name) { - case "modeleCloisons": - // change PabCloisons property "modeleCloisons" and reinit it - // with new Cloisons values - const newModeleUID = sender.properties.getPropValue("modeleCloisons"); - (sender.nub as PabCloisons).setModel(newModeleUID); - // treat the fieldset as new to re-subscribe to Nub properties change events - this.afterParseFieldset(sender); - this.reset(); - break; - } - break; - - case "fs_cloison_aval": - switch (data.name) { - case "modeleCloisonAval": - // change Pab property "modeleCloisonAval" and reinit it - // with new ParallelStructure values - const newModeleAvalUID = sender.properties.getPropValue("modeleCloisonAval"); - this.pabNub.setDownWall(newModeleAvalUID); - // treat the fieldset as new to re-subscribe to Nub properties change events - this.afterParseFieldset(sender); - this.reset(); - break; - } - break; - } - } - } */ - // debug method private dumpPabStructure(pab: Pab) { console.log(`PAB: ${pab.uid}, ${pab.children.length} children`); for (const c of pab.children) { console.log( - ` * child: ${c.uid}, based on ${c.properties.getPropValue("modeleCloisons")}` - + ` (cote amont ${c.prms.Z1.singleValue}, longueur ${c.prms.LB.singleValue})` + ` * child: ${c.uid} (cote amont ${c.prms.Z1.singleValue}, longueur ${c.prms.LB.singleValue})` ); } if (pab.downWall) { diff --git a/src/app/formulaire/fieldset.ts b/src/app/formulaire/fieldset.ts index 10d1a13ad7cabee398a04b2fc72dc97eb9f33846..8d814877614571d60234b3543cf99252e804eb43 100644 --- a/src/app/formulaire/fieldset.ts +++ b/src/app/formulaire/fieldset.ts @@ -380,20 +380,6 @@ export class FieldSet extends FormulaireElement implements Observer { case "select_target": // courbes de remous, variable à calculer this.setPropValue("varCalc", data.value.value); break; - case "select_modele_cloisons": // passe à bassins, modèle de cloisons - let valToSet; - if (data.value) { - valToSet = data.value.id; - } - this.setPropValue("modeleCloisons", valToSet); - break; - case "select_modele_cloison_aval": // passe à bassins, modèle de la cloison aval - let valToSet2; - if (data.value) { - valToSet2 = data.value.id; - } - this.setPropValue("modeleCloisonAval", valToSet2); - break; } break; } diff --git a/src/app/results/plottable-pab-results.ts b/src/app/results/plottable-pab-results.ts index 95d123e39d3c68e2816fa3143ee82656f85f78fa..bcfa6cf532597a0d0dd330e3073abef96de32428 100644 --- a/src/app/results/plottable-pab-results.ts +++ b/src/app/results/plottable-pab-results.ts @@ -30,7 +30,11 @@ export class PlottablePabResults implements PlottableData { * @param symbol parameter / result symbol (ex: "Q") */ public getChartAxisLabel(symbol: string): string { - return this.pabResults.headers[this.pabResults.columns.indexOf(symbol)]; + if (symbol === "x") { // specific case for wall abscissa + return ServiceFactory.instance.i18nService.localizeText("INFO_LIB_ABSCISSE_CLOISON"); + } else { + return this.pabResults.headers[this.pabResults.columns.indexOf(symbol)]; + } } public expandLabelFromSymbol(symbol: string): string { @@ -42,7 +46,8 @@ export class PlottablePabResults implements PlottableData { * as X or Y chart axis */ public getAvailableChartAxis(): string[] { - return this.pabResults.columns; + // add wall abscissa on the fly + return [ "x" ].concat(this.pabResults.columns); } // just to implement interface @@ -67,10 +72,9 @@ export class PlottablePabResults implements PlottableData { switch (symbol) { case "CLOISON": data.push(""); - for (let i = 0; i < l; i++) { + for (let i = 0; i <= l; i++) { // <= for one extra step (downwall) data.push("" + (i + 1)); } - data.push(ServiceFactory.instance.i18nService.localizeText("INFO_LIB_AVAL")); break; case "DH": @@ -86,7 +90,7 @@ export class PlottablePabResults implements PlottableData { break; case "Z": - for (let i = 0; i < l - 1; i++) { + for (let i = 0; i < l; i++) { data.push(pr.cloisonsResults[i].vCalc.toFixed(nDigits)); } data.push(pr.cloisonAvalResults.vCalc.toFixed(nDigits)); @@ -104,6 +108,16 @@ export class PlottablePabResults implements PlottableData { } data.push(""); break; + + case "x": // wall abscissa + data.push(""); + for (let i = 0; i < l; i++) { + const er = pr.cloisonsResults[i].getExtraResult(symbol); + data.push((er !== undefined) ? er.toFixed(nDigits) : ""); + } + const erXdw = pr.cloisonAvalResults.getExtraResult(symbol); + data.push((erXdw !== undefined) ? erXdw.toFixed(nDigits) : ""); + break; } return data; diff --git a/src/app/services/formulaire/formulaire.service.ts b/src/app/services/formulaire/formulaire.service.ts index 64c583b247bfbc2a17a3099d2cd71cd2c2f6daa2..5267f89021cf945589b31adc8d36048b6bef187e 100644 --- a/src/app/services/formulaire/formulaire.service.ts +++ b/src/app/services/formulaire/formulaire.service.ts @@ -334,20 +334,14 @@ export class FormulaireService extends Observable { } } - // add fieldsets for existing PabCloisons if needed - // (when loading session only) - if (f.currentNub instanceof Pab) { - for (const child of f.currentNub.children) { - for (const e of f.allFormElements) { - if (e instanceof FieldsetContainer) { // @TODO manage many containers one day ? - e.addFromTemplate(0, undefined, child); - } - } - } - } - // when creating a new Pab, add one wall with one device, plus the downwall - if (f instanceof FormulairePab) { + // (when loading session, those items are already present) + if ( + f instanceof FormulairePab + && f.currentNub instanceof Pab + && f.currentNub.children.length === 0 + && f.currentNub.downWall === undefined + ) { // 1. one wall const newWall = Session.getInstance().createNub( new Props({ @@ -619,22 +613,6 @@ export class FormulaireService extends Observable { } }); } - // list Cloisons / downWall models dependencies for each PAB Nub - if (e.props.calcType === CalculatorType.Pab) { - // TODO Check if can be removed - // Cloisons models - e.children.forEach((c) => { - if (c.props.calcType === CalculatorType.Cloisons) { // who knows ? - if (c.props.modeleCloisons && ! nubInfo.requires.includes(c.props.modeleCloisons)) { - nubInfo.requires.push(c.props.modeleCloisons); - } - } - }); - // Downstream wall - if (e.props.modeleCloisonAval && ! nubInfo.requires.includes(e.props.modeleCloisonAval)) { - nubInfo.requires.push(e.props.modeleCloisonAval); - } - } // list children nubs for each Nub if (e.children) { e.children.forEach((p) => { diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json index f88b0bb858089c4cffef0f535d2ab22eeb78fe57..1abffb6c68542e304be0b2c06b2005aacfce6873 100644 --- a/src/locale/messages.en.json +++ b/src/locale/messages.en.json @@ -111,8 +111,10 @@ "INFO_WALL_REMOVED": "Wall #%s removed", "INFO_LECHAPTCALMON_TITRE_COURT": "Lechapt-C.", "INFO_LECHAPTCALMON_TITRE": "Lechapt-Calmon", + "INFO_LIB_ABSCISSE_CLOISON": "Wall abscissa", "INFO_LIB_ALPHA": "Alpha coefficient", "INFO_LIB_ALPHA2": "Half-angle at the apex", + "INFO_LIB_AMONT": "Upstream", "INFO_LIB_AVAL": "Downstream", "INFO_LIB_B": "Surface width", "INFO_LIB_BB": "Pool width", diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json index 1e4e1bb5a8eef6f26780bf59a73bc046acba44d3..db1a816be783fad06799d12928e2adaeb88f3e75 100644 --- a/src/locale/messages.fr.json +++ b/src/locale/messages.fr.json @@ -111,8 +111,10 @@ "INFO_WALL_REMOVED": "Cloison n°%s supprimée", "INFO_LECHAPTCALMON_TITRE_COURT": "Lechapt-C.", "INFO_LECHAPTCALMON_TITRE": "Lechapt-Calmon", + "INFO_LIB_ABSCISSE_CLOISON": "Abscisse de la cloison", "INFO_LIB_ALPHA": "Coefficient alpha", "INFO_LIB_ALPHA2": "Demi-angle au sommet", + "INFO_LIB_AMONT": "Amont", "INFO_LIB_AVAL": "Aval", "INFO_LIB_B": "Largeur au miroir", "INFO_LIB_BB": "Largeur du bassin",