diff artifacts/doc/conf/meta-data.xml @ 7405:350057df635b

(issue965) Use new datacage magic to have year filtering for bedheights
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 21 Oct 2013 18:57:30 +0200
parents 93ae1aa8ade9
children 91ff42699f58
line wrap: on
line diff
--- a/artifacts/doc/conf/meta-data.xml	Mon Oct 21 17:54:34 2013 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Mon Oct 21 18:57:30 2013 +0200
@@ -1668,6 +1668,20 @@
     </dc:macro>
 
     <dc:macro name="minfo-heights">
+      <dc:variable name="year_from" expr="
+        dc:min-number(
+        dc:find-all(
+          '\d{4}',
+            dc:replace-all(
+              $diffids, '[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}', '')))"
+        type="number"/>
+      <dc:variable name="year_to" expr="
+        dc:max-number(
+          dc:find-all(
+            '\d{4}',
+            dc:replace-all(
+              $diffids, '[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}', '')))"
+        type="number"/>
       <bedheights>
         <dc:call-macro name="bed-heights-single"/>
         <dc:call-macro name="bed-heights-epoch"/>
@@ -1685,7 +1699,8 @@
             FROM bed_height_single bhs
                JOIN bed_height_type bht ON bht.id = bhs.type_id
             WHERE bhs.river_id = ${river_id}
-              AND lower(bhs.description) NOT LIKE '%epoch%'
+            AND lower(bhs.description) NOT LIKE '%epoch%'
+            AND bhs.year BETWEEN ${year_from} AND ${year_to}
           </dc:statement>
           <dc:if test="dc:has-result()">
             <dc:group expr="$bedh_year">
@@ -1714,6 +1729,7 @@
             FROM bed_height_single
             WHERE river_id = ${river_id}
               AND lower(description) LIKE '%epoch%'
+              AND year BETWEEN ${year_from} AND ${year_to}
           </dc:statement>
           <dc:for-each>
             <height factory="bedheight" target_out="{$out}"

http://dive4elements.wald.intevation.org