changeset 8308:b5e63ad6d307

Q-symmetry: SQ-relations should not be filtered for specific outs (and optimised statement a bit).
author "Tom Gottfried <tom@intevation.de>"
date Tue, 23 Sep 2014 12:56:23 +0200
parents 60212ed56023
children 4acf7cff7355
files artifacts/doc/conf/meta-data.xml
diffstat 1 files changed, 26 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/doc/conf/meta-data.xml	Tue Sep 23 10:11:52 2014 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Tue Sep 23 12:56:23 2014 +0200
@@ -1457,7 +1457,6 @@
 
     <!-- prototypes -->
 
-    <!-- discharge curve prototype -->
     <dc:macro name="discharge-curve-prototype">
         <computed_discharge_curve>
           <dc:call-macro name="discharge_table_gauge"/>
@@ -2128,7 +2127,7 @@
     <dc:macro name="sqrelations">
       <dc:context>
         <dc:statement>
-          SELECT sq.description  AS description,
+          SELECT
             ti.start_time        AS start_time,
             ti.stop_time         AS stop_time,
             ms.name              AS station_name,
@@ -2136,43 +2135,38 @@
             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 time_intervals ti ON ti.id = sq.time_interval_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
+          JOIN rivers r ON r.id = ra.river_id
           WHERE r.id = ${river_id}
-          ORDER BY station_km, start_time, stop_time
+          ORDER BY start_time, stop_time
         </dc:statement>
         <dc:if test="dc:has-result()">
           <sq_relations>
-            <dc:filter expr="$out = concat('sq_relation_', $parameter) or
-                             $out = 'sq_overview'">
-              <dc:group expr="concat('Parameter ', dc:uppercase($parameter))">
-                <parameter description="{dc:group-key()}">
-                  <dc:for-each>
-                    <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};{dc:uppercase($parameter)} - {$station_name}: {$combined_desc}"
-                                     description="{$combined_desc}"/>
-                          </dc:for-each>
-                        </station>
-                      </dc:group>
-                    </dc:group>
-                  </dc:for-each>
-                </parameter>
-              </dc:group>
-            </dc:filter>
+            <dc:group expr="concat('Parameter ', dc:uppercase($parameter))">
+              <parameter description="{dc:group-key()}">
+                <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};{dc:uppercase($parameter)} - {$station_name}: {$combined_desc}"
+                                 description="{$combined_desc}"/>
+                      </dc:for-each>
+                    </station>
+                  </dc:group>
+                </dc:group>
+              </parameter>
+            </dc:group>
           </sq_relations>
         </dc:if>
       </dc:context>

http://dive4elements.wald.intevation.org