Mercurial > gemma
comparison pkg/controllers/surveys.go @ 4782:fc082c611b8b v4.2
api/surveys list all existing surveys (no filter by gauge validity)
The api endpoint is expected to deliver all SR available for the given bottleneck.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Tue, 22 Oct 2019 17:51:46 +0200 |
parents | 4394daeea96a |
children | e68220372832 |
comparison
equal
deleted
inserted
replaced
4779:eb310f7e53b0 | 4782:fc082c611b8b |
---|---|
26 mw "gemma.intevation.de/gemma/pkg/middleware" | 26 mw "gemma.intevation.de/gemma/pkg/middleware" |
27 ) | 27 ) |
28 | 28 |
29 const ( | 29 const ( |
30 listSurveysSQL = ` | 30 listSurveysSQL = ` |
31 SELECT | 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 g.objname AS gauge_objname, |
36 r.value AS waterlevel_value | 36 r.value AS waterlevel_value |
39 JOIN waterway.gauges AS g | 39 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 AND s.date_info::timestamptz <@ b.validity` | 44 WHERE b.objnam = $1` |
45 ) | 45 ) |
46 | 46 |
47 func listSurveys(req *http.Request) (jr mw.JSONResult, err error) { | 47 func listSurveys(req *http.Request) (jr mw.JSONResult, err error) { |
48 | 48 |
49 bottleneckName := mux.Vars(req)["bottleneck"] | 49 bottleneckName := mux.Vars(req)["bottleneck"] |