changeset 4587:ffa3148b95c5 iso-areas

Merged default into iso-areas branch.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 08 Oct 2019 22:36:54 +0200
parents 90936099d1c8 (current diff) 2077347ef345 (diff)
children 7844a3a630eb
files
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/controllers/stretches.go	Tue Oct 08 17:21:56 2019 +0200
+++ b/pkg/controllers/stretches.go	Tue Oct 08 22:36:54 2019 +0200
@@ -31,14 +31,21 @@
 	"gemma.intevation.de/gemma/pkg/middleware"
 )
 
+// The following requests are taking _all_ bottlenecks into account, not only
+// the currently valid ones.  This is neccessary, as we are doing reports on
+// arbitrary time ranges and bottlenecks currently active might have been in the
+// selected time range.
+//
+// FIXME: the better solution would be to limit the bottlenecks to those with:
+//   b.validity && REQUESTED_TIME_RANGE
+
 const (
 	selectSectionBottlenecks = `
 SELECT
   distinct(b.objnam),
   b.limiting
 FROM waterway.sections s, waterway.bottlenecks b
-WHERE b.validity @> current_timestamp
-  AND ST_Intersects(b.area, s.area)
+WHERE ST_Intersects(b.area, s.area)
   AND s.name = $1`
 
 	selectStretchBottlenecks = `
@@ -46,8 +53,7 @@
   distinct(b.objnam),
   b.limiting
 FROM users.stretches s, waterway.bottlenecks b
-WHERE b.validity @> current_timestamp
-  AND ST_Intersects(b.area, s.area)
+WHERE ST_Intersects(b.area, s.area)
   AND s.name = $1`
 )