diff artifacts/doc/conf/meta-data.xml @ 7672:691d15750513

(issue1474) Change order of measurement stations
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 06 Dec 2013 16:47:02 +0100
parents a6363e080e2c
children 7e4c5bd86227
line wrap: on
line diff
--- a/artifacts/doc/conf/meta-data.xml	Fri Dec 06 16:49:43 2013 +0100
+++ b/artifacts/doc/conf/meta-data.xml	Fri Dec 06 16:47:02 2013 +0100
@@ -1915,26 +1915,30 @@
             ti.stop_time         AS stop_time,
             ms.name              AS station_name,
             lower(sqv.parameter) AS parameter,
-            sqv.id               AS sqvid
+            sqv.id               AS sqvid,
+            ra.a                 AS station_km
           FROM sq_relation sq
           JOIN time_intervals ti ON ti.id   = sq.time_interval_id
           JOIN rivers r ON r.id = sq.river_id
           JOIN sq_relation_value sqv ON sqv.sq_relation_id = sq.id
           JOIN measurement_station ms ON sqv.measurement_station_id = ms.id
+          JOIN ranges ra ON ms.range_id = ra.id
           WHERE r.id = ${river_id}
-          ORDER BY start_time, stop_time
+          ORDER BY station_km, start_time, stop_time
         </dc:statement>
         <dc:if test="dc:has-result()">
           <sq_relations>
             <dc:filter expr="$out = concat('sq_relation_', $parameter)">
-              <dc:group expr="$station_name">
-                <station description="{dc:group-key()}">
-                  <dc:for-each>
-                    <dc:variable name="combined_desc" expr="concat(dc:date-format('yyyy', $start_time), ' bis ', dc:date-format('yyyy', $stop_time))"/>
-                    <sqvalue factory="staticsqrelation" target_out="{$out}"
-                      ids="{$sqvid};{$station_name}: {$combined_desc}" description="{$combined_desc}"/>
-                  </dc:for-each>
-                </station>
+              <dc:group expr="$station_km" type="number">
+                <dc:group expr="concat('km ', $station_km, ': ', $station_name)">
+                  <station description="{dc:group-key()}">
+                    <dc:for-each>
+                      <dc:variable name="combined_desc" expr="concat(dc:date-format('yyyy', $start_time), ' bis ', dc:date-format('yyyy', $stop_time))"/>
+                      <sqvalue factory="staticsqrelation" target_out="{$out}"
+                        ids="{$sqvid};{$station_name}: {$combined_desc}" description="{$combined_desc}"/>
+                    </dc:for-each>
+                  </station>
+                </dc:group>
               </dc:group>
             </dc:filter>
           </sq_relations>

http://dive4elements.wald.intevation.org