comparison 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
comparison
equal deleted inserted replaced
4890:5d9c7fcda566 4891:e68220372832
30 listSurveysSQL = ` 30 listSurveysSQL = `
31 SELECT DISTINCT 31 SELECT DISTINCT
32 s.bottleneck_id, 32 s.bottleneck_id,
33 s.date_info::text, 33 s.date_info::text,
34 s.depth_reference, 34 s.depth_reference,
35 g.objname AS gauge_objname, 35 COALESCE(g.objname, 'ERROR: MISSING GAUGE') AS gauge_objname,
36 r.value AS waterlevel_value 36 r.value AS waterlevel_value
37 FROM waterway.bottlenecks AS b 37 FROM waterway.bottlenecks AS b
38 JOIN waterway.sounding_results AS s ON b.bottleneck_id = s.bottleneck_id 38 JOIN waterway.sounding_results AS s ON b.bottleneck_id = s.bottleneck_id
39 JOIN waterway.gauges AS g 39 LEFT JOIN waterway.gauges AS g
40 ON b.gauge_location = g.location AND s.date_info::timestamptz <@ g.validity 40 ON b.gauge_location = g.location AND s.date_info::timestamptz <@ g.validity
41 LEFT JOIN waterway.gauges_reference_water_levels AS r 41 LEFT JOIN waterway.gauges_reference_water_levels AS r
42 ON s.depth_reference = r.depth_reference 42 ON s.depth_reference = r.depth_reference
43 AND g.location = r.location AND g.validity = r.validity 43 AND g.location = r.location AND g.validity = r.validity
44 WHERE b.objnam = $1` 44 WHERE b.objnam = $1`