From a143d99978decd95edb0b4eab68db8fe8883f5a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Mon, 9 Jan 2023 16:59:24 +0100
Subject: [PATCH 1/4] update jalhyd_branch to
 337-lechapt-et-calmon-erreur-de-selection-de-materiau

refs #589
---
 jalhyd_branch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jalhyd_branch b/jalhyd_branch
index a210a99ef..ac32d80eb 100644
--- a/jalhyd_branch
+++ b/jalhyd_branch
@@ -1 +1 @@
-329-un-parametre-lie-ne-change-pas-d-etat-apres-la-suppression-du-module-cible
+337-lechapt-et-calmon-erreur-de-selection-de-materiau
-- 
GitLab


From d3f807ca5a9f649677a86822a10f4a5d4c8418e0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Mon, 9 Jan 2023 16:59:48 +0100
Subject: [PATCH 2/4] test(e2e): Lechapt-Calmon: check that material type
 modification changes results

refs #589
---
 e2e/lechapt-calmon.e2e-spec.ts | 74 ++++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)
 create mode 100644 e2e/lechapt-calmon.e2e-spec.ts

diff --git a/e2e/lechapt-calmon.e2e-spec.ts b/e2e/lechapt-calmon.e2e-spec.ts
new file mode 100644
index 000000000..f0b991c6d
--- /dev/null
+++ b/e2e/lechapt-calmon.e2e-spec.ts
@@ -0,0 +1,74 @@
+import { ListPage } from "./list.po";
+import { browser, by } from "protractor";
+import { CalculatorPage } from "./calculator.po";
+import { PreferencesPage } from "./preferences.po";
+import { Navbar } from "./navbar.po";
+
+/**
+ * Check that created/cloned structures have empty fields when
+ * "empty fields on calculator creation" is enabled
+ */
+describe("Lechapt&Calmon - ", () => {
+    let prefPage: PreferencesPage;
+    let listPage: ListPage;
+    let calcPage: CalculatorPage;
+    let navBar: Navbar;
+
+    beforeAll(() => {
+        prefPage = new PreferencesPage();
+        listPage = new ListPage();
+        calcPage = new CalculatorPage();
+        navBar = new Navbar();
+        browser.manage().window().setPosition(2000, 30);
+    });
+
+    beforeEach(async () => {
+        // disable evil option "empty fields on module creation"
+        await prefPage.navigateTo();
+        await browser.sleep(200);
+        await prefPage.disableEvilEmptyFields();
+        await browser.sleep(200);
+    });
+
+    async function setup() {
+        // start page
+        await navBar.clickNewCalculatorButton();
+        await browser.sleep(200);
+
+        // open Lechapt-Calmon calculator
+        await listPage.clickMenuEntryForCalcType(1);
+        await browser.sleep(200);
+    }
+
+    it("when material is modified, results should change", async () => {
+        await setup();
+
+        // select last material type
+        const materialSelect = calcPage.getSelectById("select_material");
+        await calcPage.changeSelectValue(materialSelect, 8);
+        await browser.sleep(200);
+
+        // run calculation
+        const calcButton = calcPage.getCalculateButton();
+        await calcButton.click();
+        await browser.sleep(200);
+
+        // store total pressure loss result
+        const res1 = calcPage.getAllFixedResultsRows().get(4);
+        const pl1 = await res1.all(by.css("td")).get(1).getText();
+
+        // select first material type
+        await calcPage.changeSelectValue(materialSelect, 0);
+        await browser.sleep(200);
+
+        // run calculation
+        await calcButton.click();
+        await browser.sleep(200);
+
+        // compare total pressure loss result with first calculaiotn
+        const res2 = calcPage.getAllFixedResultsRows().get(4);
+        const pl2 = await res2.all(by.css("td")).get(1).getText();
+
+        expect(pl1).not.toEqual(pl2);
+    });
+});
-- 
GitLab


From 974b4fc9326d8d52b635c43e72c48a9fb072fd7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Mon, 9 Jan 2023 17:00:57 +0100
Subject: [PATCH 3/4] fix: Lechapt-Calmon JSON calculator configuration: remove
 unused defaultMaterial field

refs #589
---
 src/app/calculators/lechaptcalmon/config.json | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/app/calculators/lechaptcalmon/config.json b/src/app/calculators/lechaptcalmon/config.json
index 431552de8..610dc7f1a 100644
--- a/src/app/calculators/lechaptcalmon/config.json
+++ b/src/app/calculators/lechaptcalmon/config.json
@@ -2,7 +2,6 @@
     {
         "id": "fs_materiau",
         "type": "fieldset",
-        "defaultMaterial": "UnlinedCastIronCoarseConcrete",
         "fields": [
             {
                 "id": "select_material",
@@ -31,4 +30,4 @@
         "selectIds": [ "select_material" ],
         "help": "hyd_en_charge/lechapt-calmon.html"
     }
-]
\ No newline at end of file
+]
-- 
GitLab


From 64996d897a255bc17fe766b41ca7c2df415c0967 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Tue, 10 Jan 2023 08:58:46 +0100
Subject: [PATCH 4/4] update CHANGELOG to 4.16.2

refs #589
---
 CHANGELOG.md | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a56bc3b8c..0ab64230a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
 # Historique des versions
 
+### 4.16.2 - 2023-01-10
+
+#### Correction de bogues
+
+* Lechapt et Calmon : erreur de sélection de matériau
+([jalhyd#337](https://gitlab.irstea.fr/cassiopee/jalhyd/-/issues/337), [nghyd#589](https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/589))
+
 ### 4.16.1 - 2022-11-16
 
 #### Correction de bogues
-- 
GitLab