From 687cd57f8c414d88b7df3abafd6ade7a33615eac Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Mon, 18 Nov 2019 16:16:31 +0100
Subject: [PATCH] Fix #304

---
 .../fixedvar-results/fixedvar-results.component.html     | 2 +-
 .../fixedvar-results/fixedvar-results.component.ts       | 7 +++++++
 src/app/results/param-calc-results.ts                    | 9 +++++++++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/app/components/fixedvar-results/fixedvar-results.component.html b/src/app/components/fixedvar-results/fixedvar-results.component.html
index 0b7fc09fc..7676b0268 100644
--- a/src/app/components/fixedvar-results/fixedvar-results.component.html
+++ b/src/app/components/fixedvar-results/fixedvar-results.component.html
@@ -2,7 +2,7 @@
     <!-- journal -->
     <log></log>
 
-    <results-chart *ngIf="showVarResults"></results-chart>
+    <results-chart [hidden]="! showVarResultsChart"></results-chart>
 
     <div>
         <!-- table des résultats fixés -->
diff --git a/src/app/components/fixedvar-results/fixedvar-results.component.ts b/src/app/components/fixedvar-results/fixedvar-results.component.ts
index 813d37738..58bbbf90c 100644
--- a/src/app/components/fixedvar-results/fixedvar-results.component.ts
+++ b/src/app/components/fixedvar-results/fixedvar-results.component.ts
@@ -167,6 +167,13 @@ export class FixedVarResultsComponent extends ResultsComponent implements DoChec
         return this._varResults && this._varResults.hasResults;
     }
 
+    /**
+     * affichage du graphique des résultats variés
+     */
+    public get showVarResultsChart(): boolean {
+        return this._varResults && this._varResults.hasPlottableResults;
+    }
+
     public getFixedResultClass(i: number) {
         // tslint:disable-next-line:no-bitwise
         return "result_id_" + String(i & 1);
diff --git a/src/app/results/param-calc-results.ts b/src/app/results/param-calc-results.ts
index 60c0e257d..3f5c8c4b0 100644
--- a/src/app/results/param-calc-results.ts
+++ b/src/app/results/param-calc-results.ts
@@ -36,6 +36,15 @@ export abstract class CalculatedParamResults extends CalculatorResults {
     }
 
     public get hasResults(): boolean {
+        if (this.result === undefined) {
+            return false;
+        }
+        return true;
+        // return ! this.result.hasOnlyErrors;
+    }
+
+    /** return true if there is something to display on the variable results chart */
+    public get hasPlottableResults(): boolean {
         if (this.result === undefined) {
             return false;
         }
-- 
GitLab