diff pkg/controllers/search.go @ 3666:db87f34805fb

Align bottleneck validity at gauges Ensuring the validity of a bottleneck version is always contained by the validity of the referenced gauge version allows to reliably determine matching reference values of the gauge at a point in time. Since this implies that a bottleneck version might be cut into more than one time ranges, the concept of having only one non-erased version is no longer applicable and replaced by using the 'current' version of a bottleneck. Fairway availability data are always kept with the 'current' bottleneck version to have them at hand alltogether for analyses over longer time ranges.
author Tom Gottfried <tom@intevation.de>
date Sat, 15 Jun 2019 14:36:50 +0200
parents 02951a62e8c6
children 1504856c9378
line wrap: on
line diff
--- a/pkg/controllers/search.go	Sat Jun 15 09:24:28 2019 +0200
+++ b/pkg/controllers/search.go	Sat Jun 15 14:36:50 2019 +0200
@@ -42,7 +42,7 @@
     ST_AsGeoJSON(ST_Centroid(area))::json AS geom,
     'bottleneck' AS type
   FROM waterway.bottlenecks
-  WHERE NOT erased
+  WHERE validity @> current_timestamp
 ORDER BY objnam) r
 `
 )