[PATCH 3 of 5] issue1345: Minor refactoring, made structure for epoch loads equal year loads
Wald Commits
scm-commit at wald.intevation.org
Thu Oct 10 11:16:58 CEST 2013
# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1381396770 -7200
# Node ID 03fa985dd0440b5fdb4857f851d7b3f464dd214c
# Parent 0ba4c4fbd410af916b9ec87ab24e4f12b3092535
issue1345: Minor refactoring, made structure for epoch loads equal year loads.
diff -r 0ba4c4fbd410 -r 03fa985dd044 artifacts/doc/conf/meta-data.xml
--- a/artifacts/doc/conf/meta-data.xml Thu Oct 10 11:10:50 2013 +0200
+++ b/artifacts/doc/conf/meta-data.xml Thu Oct 10 11:19:30 2013 +0200
@@ -1305,6 +1305,53 @@
ids="{$syid}" />
</dc:for-each>
</dc:macro>
+
+ <dc:macro name="loads">
+ <dc:if test="dc:has-result()">
+ <dc:filter expr="$fraction='sand'">
+ <dc:if test="dc:has-result()">
+ <sand>
+ <dc:call-macro name="one-load"/>
+ </sand>
+ </dc:if>
+ </dc:filter>
+ <dc:filter expr="$fraction='fine_middle'">
+ <dc:if test="dc:has-result()">
+ <fine_middle>
+ <dc:call-macro name="one-load"/>
+ </fine_middle>
+ </dc:if>
+ </dc:filter>
+ <dc:filter expr="$fraction='coarse'">
+ <dc:if test="dc:has-result()">
+ <coarse>
+ <dc:call-macro name="one-load"/>
+ </coarse>
+ </dc:if>
+ </dc:filter>
+ <dc:filter expr="$fraction='suspended_sediment'">
+ <dc:if test="dc:has-result()">
+ <susp_sediment>
+ <dc:call-macro name="one-load"/>
+ </susp_sediment>
+ </dc:if>
+ </dc:filter>
+ <dc:filter expr="$fraction='susp_sand'">
+ <dc:if test="dc:has-result()">
+ <susp_sand>
+ <dc:call-macro name="one-load"/>
+ </susp_sand>
+ </dc:if>
+ </dc:filter>
+ <dc:filter expr="$fraction='susp_sand_bed'">
+ <dc:if test="dc:has-result()">
+ <susp_sand_bed>
+ <dc:call-macro name="one-load"/>
+ </susp_sand_bed>
+ </dc:if>
+ </dc:filter>
+ </dc:if>
+ </dc:macro>
<dc:macro name="yields">
<yields>
@@ -1312,7 +1359,7 @@
<dc:context>
<dc:statement>
SELECT DISTINCT
- sy.id AS syid,
+ sy.id AS syid,
sy.description AS description,
ti.start_time AS year,
gf.name AS fraction
@@ -1326,76 +1373,28 @@
AND syv.station BETWEEN ${fromkm} AND ${tokm}
ORDER BY fraction
</dc:statement>
- <dc:if test="dc:has-result()">
- <dc:filter expr="$fraction='sand'">
- <dc:if test="dc:has-result()">
- <sand>
- <dc:call-macro name="one-load"/>
- </sand>
- </dc:if>
- </dc:filter>
- <dc:filter expr="$fraction='fine_middle'">
- <dc:if test="dc:has-result()">
- <fine_middle>
- <dc:call-macro name="one-load"/>
- </fine_middle>
- </dc:if>
- </dc:filter>
- <dc:filter expr="$fraction='coarse'">
- <dc:if test="dc:has-result()">
- <coarse>
- <dc:call-macro name="one-load"/>
- </coarse>
- </dc:if>
- </dc:filter>
- <dc:filter expr="$fraction='suspended_sediment'">
- <dc:if test="dc:has-result()">
- <susp_sediment>
- <dc:call-macro name="one-load"/>
- </susp_sediment>
- </dc:if>
- </dc:filter>
- <dc:filter expr="$fraction='susp_sand'">
- <dc:if test="dc:has-result()">
- <susp_sand>
- <dc:call-macro name="one-load"/>
- </susp_sand>
- </dc:if>
- </dc:filter>
- <dc:filter expr="$fraction='susp_sand_bed'">
- <dc:if test="dc:has-result()">
- <susp_sand_bed>
- <dc:call-macro name="one-load"/>
- </susp_sand_bed>
- </dc:if>
- </dc:filter>
- </dc:if>
+ <dc:call-macro name="loads"/>
</dc:context>
</years>
<epochs>
<dc:context>
<dc:statement>
SELECT DISTINCT
- sy.id AS syid,
+ sy.id AS syid,
sy.description AS description,
- ti.start_time AS year
+ ti.start_time AS year,
+ gf.name AS fraction
FROM sediment_yield sy
JOIN rivers r ON sy.river_id = r.id
JOIN sediment_yield_values syv ON sy.id = syv.sediment_yield_id
JOIN time_intervals ti ON sy.time_interval_id = ti.id
+ JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id
WHERE r.id = ${river_id}
AND ti.stop_time IS NOT NULL
AND syv.station BETWEEN ${fromkm} AND ${tokm}
+ ORDER BY fraction
</dc:statement>
- <dc:if test="dc:has-result()">
- <dc:for-each>
- <epoch description="{$description}"
- factory="sedimentyield"
- target_out="{$out}"
- info=""
- ids="{$syid}" />
- </dc:for-each>
- </dc:if>
+ <dc:call-macro name="loads"/>
</dc:context>
</epochs>
More information about the Dive4elements-commits
mailing list