From a8e59f642aea888f930e4822b3537b98dbe6317c Mon Sep 17 00:00:00 2001
From: Mathias Chouet <mathias.chouet@irstea.fr>
Date: Wed, 15 Apr 2020 15:38:44 +0200
Subject: [PATCH] Fix jalhyd#205 - Jet: hide trajectory chart when dicho
 calculation fails

---
 src/app/components/jet-results/jet-results.component.html | 2 +-
 src/app/components/jet-results/jet-results.component.ts   | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/app/components/jet-results/jet-results.component.html b/src/app/components/jet-results/jet-results.component.html
index 45e633fa8..2b724522b 100644
--- a/src/app/components/jet-results/jet-results.component.html
+++ b/src/app/components/jet-results/jet-results.component.html
@@ -4,7 +4,7 @@
 
     <results-chart *ngIf="showVarResults"></results-chart>
 
-    <jet-trajectory-chart *ngIf="hasResults"></jet-trajectory-chart>
+    <jet-trajectory-chart *ngIf="hasValidResults"></jet-trajectory-chart>
 
     <div>
         <!-- table des rÊsultats fixÊs -->
diff --git a/src/app/components/jet-results/jet-results.component.ts b/src/app/components/jet-results/jet-results.component.ts
index e64a1871e..50d8a1a1d 100644
--- a/src/app/components/jet-results/jet-results.component.ts
+++ b/src/app/components/jet-results/jet-results.component.ts
@@ -24,6 +24,14 @@ export class JetResultsComponent extends FixedVarResultsComponent {
         );
     }
 
+    public get hasValidResults(): boolean {
+        return this.hasResults && (
+            this._fixedResults && this._fixedResults.result && this._fixedResults.result.sourceNub.result.ok
+            ||
+            this._varResults&& this._varResults.result && this._varResults.result.sourceNub.result.ok
+        );
+    }
+
     public updateView() {
         if (this.jetTrajectoryChartComponent) {
             this.jetTrajectoryChartComponent.results = undefined;
-- 
GitLab