diff --git a/e2e/duplicate-results.e2e-spec.ts b/e2e/duplicate-results.e2e-spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..f0c0c57077cc6d366f9124172e718bd7d449f37a --- /dev/null +++ b/e2e/duplicate-results.e2e-spec.ts @@ -0,0 +1,42 @@ +import { browser } from "protractor"; +import { PreferencesPage } from "./preferences.po" +import { Navbar } from "./navbar.po"; +import { ListPage } from "./list.po"; +import { CalculatorPage } from "./calculator.po"; + +describe("ngHyd − check that results are not duplicated", () => { + let prefPage: PreferencesPage; + let navBar: Navbar; + let listPage: ListPage; + let calcPage: CalculatorPage; + + beforeEach(async () => { + prefPage = new PreferencesPage(); + listPage = new ListPage(); + navBar = new Navbar(); + calcPage = new CalculatorPage(); + + // disable evil option "empty fields on module creation" + await prefPage.navigateTo(); + await browser.sleep(200); + await prefPage.disableEvilEmptyFields(); + await browser.sleep(200); + }); + + it("in 'baffle fishway: setup' calculator", async () => { + // open baffle fishway setup calculator + await navBar.clickNewCalculatorButton(); + await listPage.clickMenuEntryForCalcType(28); + await browser.sleep(200); + + // run calculation + const calcButton = calcPage.getCalculateButton(); + await calcButton.click(); + + // check result count + const fixRows = calcPage.getAllFixedResultsRows(); + const nbRows = await fixRows.count(); + console.log(nbRows); + expect(nbRows).toBe(24); // boundaries are included + }); +}); diff --git a/src/app/components/fixedvar-results/fixed-results.component.ts b/src/app/components/fixedvar-results/fixed-results.component.ts index debea3e405eed6d0432bf7bb2d80c687a5a38ca0..7fb67ea7f92d6c3ca87749fdad152aaff2fe77b3 100644 --- a/src/app/components/fixedvar-results/fixed-results.component.ts +++ b/src/app/components/fixedvar-results/fixed-results.component.ts @@ -183,30 +183,6 @@ export class FixedResultsComponent extends ResultsComponentDirective { } } } - - // 2) else, is it a fixed parameter ? - if (! resultFound) { - for (const fp of this.fixedParams) { - if (fp.symbol === symbol) { - let label = this.formattedLabel(fp); - const nub = fp.paramDefinition.parentNub; - // add child type and position before label - if (nub && nub.parent && nub.parent.childrenType) { - const pos = nub.findPositionInParent(); - // label = this.intlService.localizeText("INFO_OUVRAGE") + " n°" + (pos + 1) + ": " + label; - const cn = capitalize(this.intlService.childName(nub)); - label = sprintf(this.intlService.localizeText("INFO_STUFF_N"), cn) - + (pos + 1) + ": " + label; - } - label += this._fixedResults.getHelpLink(symbol); - data.push({ - label: label, - value: this.formattedValue(fp), - isCalcResult: false // for CSS - }); - } - } - } } return data; } diff --git a/src/app/formulaire/definition/form-fixedvar.ts b/src/app/formulaire/definition/form-fixedvar.ts index 7509e9bd57934d51b9c51418f1989c80bf3fc489..7b596ffbf07e355a534a3298fc67bdb6a641b07c 100644 --- a/src/app/formulaire/definition/form-fixedvar.ts +++ b/src/app/formulaire/definition/form-fixedvar.ts @@ -108,7 +108,7 @@ export class FormulaireFixedVar extends FormulaireDefinition { protected compute() { this.runNubCalc(this.currentNub); this.refreshFieldsets(); // important: before reaffectResultComponents() or it will break results components localization - this.reaffectResultComponents(); + // this.reaffectResultComponents(); // seems useless since called from runNubCalc() } protected reaffectResultComponents() { diff --git a/src/app/results/var-results.ts b/src/app/results/var-results.ts index 834853ba4e6a242a6f329ac8472b05dc16ba7b97..705d514fbc9277b078a71d2129b425c244b63014 100644 --- a/src/app/results/var-results.ts +++ b/src/app/results/var-results.ts @@ -355,6 +355,7 @@ export class VarResults extends CalculatedParamResults implements PlottableData // result keys (extra or not) - some lines might miss some results, in case of an error; // use those keys to ensure all columns are filled if (this.resultKeys.length === 0) { + this.resultKeys.push(this.result.symbol); for (const re of this.result.resultElements) { // re:ResultElement for (const erk in re.values) { if (!this.resultKeys.includes(erk)) {