[PATCH 2 of 4] (issue1391) Filter by reference_gauge or by KM

Wald Commits scm-commit at wald.intevation.org
Mon Aug 19 10:06:29 CEST 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1376638767 -7200
# Node ID 863a67e10c0c280a5781ae60e7f4e7e2cf8c7a47
# Parent  9351bc4852a83f69f363b78b6216132443c74e40
(issue1391) Filter by reference_gauge or by KM

diff -r 9351bc4852a8 -r 863a67e10c0c artifacts/doc/conf/meta-data.xml
--- a/artifacts/doc/conf/meta-data.xml	Fri Aug 16 09:38:15 2013 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Fri Aug 16 09:39:27 2013 +0200
@@ -487,22 +487,23 @@
 
 
     <dc:macro name="historical_discharge_curve">
+      <dc:variable name="refgauge" type="number" expr="$reference_gauge"/>
       <dc:context>
         <dc:statement>
           SELECT g.id   AS gauge_id,
-                 g.name AS gauge_name,
-                 dt.id AS dt_id,
-                 t.start_time AS start_time,
-                 t.stop_time AS stop_time,
-                 dt.description AS desc,
-                 dt.bfg_id AS bfg_id
+          g.name AS gauge_name,
+          dt.id AS dt_id,
+          t.start_time AS start_time,
+          t.stop_time AS stop_time,
+          dt.description AS desc,
+          dt.bfg_id AS bfg_id
           FROM gauges g
           JOIN discharge_tables dt ON g.id = dt.gauge_id
           LEFT JOIN time_intervals t ON dt.time_interval_id = t.id
           WHERE g.river_id = ${river_id}
           AND dt.kind <> 0
-          AND g.station = ${fromkm}
-          AND g.station = ${tokm}
+          AND ((g.station = ${fromkm} AND g.station = ${tokm})
+          OR g.official_number = ${refgauge})
           ORDER BY start_time
         </dc:statement>
         <dc:if test="dc:has-result()">
@@ -1336,8 +1337,8 @@
           LEFT JOIN time_intervals t ON dt.time_interval_id = t.id
           WHERE g.river_id = ${river_id}
           AND dt.kind = 0
-          AND g.station = ${fromkm}
-          AND g.station = ${tokm}
+          AND ((g.station = ${fromkm} AND g.station = ${tokm})
+          OR g.official_number = ${refgauge})
         </dc:statement>
         <dc:if test="dc:has-result()">
           <current_gauge>


More information about the Dive4elements-commits mailing list