changeset 3470:104c4f683c74

fairway availabilty: prefill result mit zero values if there is no data.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 27 May 2019 11:42:14 +0200
parents 096968d5628f
children 48d09fb1d6c7
files pkg/controllers/stretches.go
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/controllers/stretches.go	Mon May 27 11:22:12 2019 +0200
+++ b/pkg/controllers/stretches.go	Mon May 27 11:42:14 2019 +0200
@@ -362,6 +362,11 @@
 	// Normalize to look like as we have only one bottleneck.
 	scale := 1 / float64(len(loaded))
 
+	empty := fmt.Sprintf("%.3f", 0.0)
+	for i := range record[1:] {
+		record[i+1] = empty
+	}
+
 	for _, r := range results {
 		record[0] = r.label
 		for i, v := range r.ldc {
@@ -619,6 +624,11 @@
 		return
 	}
 
+	empty := fmt.Sprintf("%.3f", 0.0)
+	for i := range record[1:] {
+		record[i+1] = empty
+	}
+
 	for _, res := range results {
 		record[0] = res.label