From b7082144160b98a12d93655d209eeb84d4bdc5d3 Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Tue, 16 Apr 2019 10:39:02 +0200
Subject: [PATCH] Fix #156

---
 README.md                                       |  2 +-
 .../fixedvar-results/fixed-results.component.ts | 17 +++++++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index f21cc888e..803a0d3fb 100644
--- a/README.md
+++ b/README.md
@@ -139,7 +139,7 @@ Custom Material SVG Icons will only show up when the application is deployed on
 							throw "Toto.Equation() : invalid variable name " + sVarCalc;
 					}
 
-					return new Result(v);
+					return new Result(v, this);
 				}
 			}
 
diff --git a/src/app/components/fixedvar-results/fixed-results.component.ts b/src/app/components/fixedvar-results/fixed-results.component.ts
index 8207c30c1..182ed6f68 100644
--- a/src/app/components/fixedvar-results/fixed-results.component.ts
+++ b/src/app/components/fixedvar-results/fixed-results.component.ts
@@ -6,6 +6,7 @@ import { CalculatorResults } from "../../results/calculator-results";
 import { I18nService } from "../../services/internationalisation/internationalisation.service";
 import { ApplicationSetupService } from "../../services/app-setup/app-setup.service";
 import * as XLSX from "xlsx";
+import { Structure } from "jalhyd";
 
 @Component({
     selector: "fixed-results",
@@ -67,8 +68,14 @@ export class FixedResultsComponent {
         const data = [];
         // 1. fixed parameters
         for (const fp of this.fixedParams) {
+            let label = this.formattedLabel(fp);
+            // add structure position before label
+            if (fp.paramDefinition.parentNub instanceof Structure) {
+                const pos = fp.paramDefinition.parentNub.findPositionInParent();
+                label = this.intlService.localizeText("INFO_OUVRAGE") + " n°" + (pos + 1) + ": " + label;
+            }
             data.push({
-                label: this.formattedLabel(fp),
+                label: label,
                 value: this.formattedValue(fp),
                 isCalcResult: false // for CSS
             });
@@ -82,8 +89,14 @@ export class FixedResultsComponent {
         ) {
             // 2.1. main result (sometimes empty, for ex. in "Section paramétrée")
             if (res.name && res.resultElement.vCalc !== undefined) {
+                let rLabel = this._fixedResults.calculatedParameterHeader;
+                // add structure position before label
+                if (res.sourceNub instanceof Structure) {
+                    const pos = res.sourceNub.findPositionInParent();
+                    rLabel = this.intlService.localizeText("INFO_OUVRAGE") + " n°" + (pos + 1) + ": " + rLabel;
+                }
                 data.push({
-                    label: this._fixedResults.calculatedParameterHeader,
+                    label: rLabel,
                     value: this.intlService.formatResult(res.name, res.resultElement.vCalc),
                     isCalcResult: true // for CSS
                 });
-- 
GitLab