diff pkg/controllers/surveys.go @ 4891:e68220372832

List surveys even if mandatory base data is missing. This makes the data in the system more visible even if data is missing (likely due to invalid use of source systems).
author Sascha Wilde <wilde@intevation.de>
date Mon, 10 Feb 2020 17:14:00 +0100
parents fc082c611b8b
children 5e7fca6ef935
line wrap: on
line diff
--- a/pkg/controllers/surveys.go	Mon Feb 10 15:09:59 2020 +0100
+++ b/pkg/controllers/surveys.go	Mon Feb 10 17:14:00 2020 +0100
@@ -32,11 +32,11 @@
   s.bottleneck_id,
   s.date_info::text,
   s.depth_reference,
-  g.objname AS gauge_objname,
+  COALESCE(g.objname, 'ERROR: MISSING GAUGE') AS gauge_objname,
   r.value AS waterlevel_value
 FROM waterway.bottlenecks AS b
   JOIN waterway.sounding_results AS s ON b.bottleneck_id = s.bottleneck_id
-  JOIN waterway.gauges AS g
+  LEFT JOIN waterway.gauges AS g
     ON b.gauge_location = g.location AND s.date_info::timestamptz <@ g.validity
   LEFT JOIN waterway.gauges_reference_water_levels AS r
     ON s.depth_reference = r.depth_reference