[Dive4elements-commits] [PATCH] Fix datacage for user data by adding facet filtering

Wald Commits scm-commit at wald.intevation.org
Mon May 27 15:37:25 CEST 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1369661816 -7200
# Node ID 5ba28b5636144a49e12dea4a531100e8aa8aac02
# Parent  2a4ff87ef357e473993041cc843727ef95b98659
Fix datacage for user data by adding facet filtering.

    Now the facets are joined in the user data select statement
    and afterwards we just filter on the facet name where previously
    new queryies were created.
    Grouping also fixes the repeating folders caused by the change
    in the statements during the large perfomance cleanup.

diff -r 2a4ff87ef357 -r 5ba28b563614 artifacts/doc/conf/meta-data.xml
--- a/artifacts/doc/conf/meta-data.xml	Mon May 27 15:27:31 2013 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Mon May 27 15:36:56 2013 +0200
@@ -390,41 +390,21 @@
 
     <!-- Macros to load user data -->
 
-    <dc:macro name="select-facets">
-      <!-- FIXME : this is broken now! -->
-      <dc:context>
-        <dc:statement>
-          SELECT a.gid         AS aid,
-                 f.id          AS fid,
-                 f.name        AS facet_name,
-                 f.num         AS facet_num,
-                 f.description AS facet_description
-          FROM artifacts a
-            JOIN outs o   ON o.artifact_id = a.id
-            JOIN facets f ON f.out_id = o.id
-          WHERE a.id = ${a_id}
-            AND f.name = ${facet_type}
-        </dc:statement>
+    <dc:macro name="differences">
+      <dc:filter expr="$facet_name = 'w_differences'">
         <dc:if test="dc:has-result()">
-          <dc:macro-body/>
+          <differences>
+            <dc:for-each>
+              <w_differences
+                description="{$facet_description}"
+                factory="winfo"
+                artifact-id="{$aid}"
+                ids="{$aid}"
+                out="w_differences"/>
+            </dc:for-each>
+          </differences>
         </dc:if>
-      </dc:context>
-    </dc:macro>
-
-    <dc:macro name="differences">
-      <dc:variable name="facet_type" value="w_differences"/>
-      <dc:call-macro name="select-facets">
-        <differences>
-          <dc:for-each>
-            <w_differences
-              description="{$facet_description}"
-              factory="winfo"
-              artifact-id="{$aid}"
-              ids="{$aid}"
-              out="w_differences"/>
-          </dc:for-each>
-        </differences>
-      </dc:call-macro>
+      </dc:filter>
     </dc:macro>
 
     <dc:macro name="reference-curves">


More information about the Dive4elements-commits mailing list