changeset 9091:e07a2b4606c1

Fixed km order in d50 query
author mschaefer
date Fri, 25 May 2018 11:49:31 +0200
parents 8c15c3c23ecc
children 50cfc90ac5b0
files artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/BedQualityD50KmValueFinder.java
diffstat 1 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/BedQualityD50KmValueFinder.java	Fri May 25 11:14:57 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/BedQualityD50KmValueFinder.java	Fri May 25 11:49:31 2018 +0200
@@ -57,15 +57,15 @@
      * query.
      */
     private static final String SQL_BED_D50_SUBLAYER_MEASUREMENT = //
-            "SELECT s.km, t.datum, p.tiefevon, p.tiefebis, a.d50" //
-            + " FROM sohltest t INNER JOIN station s ON t.stationid = s.stationid" //
-            + "    INNER JOIN gewaesser g ON s.gewaesserid = g.gewaesserid" //
-            + "    INNER JOIN sohlprobe p ON t.sohltestid = p.sohltestid" //
-            + "    INNER JOIN siebanalyse a ON p.sohlprobeid = a.sohlprobeid" //
-            + " WHERE (g.name = :name) AND (s.km BETWEEN :fromkm - 0.0001 AND :tokm + 0.0001)" //
-            + "    AND (p.tiefevon > 0.0) AND (p.tiefebis <= 0.5)" //
-            + "    AND (t.datum BETWEEN :fromdate AND :todate)" //
-            + " ORDER BY t.km ASC, a.d50 ASC";
+            "SELECT s.km, t.datum, p.tiefevon, p.tiefebis, a.d50"
+            + " FROM sohltest t INNER JOIN station s ON t.stationid = s.stationid"
+            + "    INNER JOIN gewaesser g ON s.gewaesserid = g.gewaesserid"
+            + "    INNER JOIN sohlprobe p ON t.sohltestid = p.sohltestid"
+            + "    INNER JOIN siebanalyse a ON p.sohlprobeid = a.sohlprobeid"
+            + " WHERE (g.name = :name) AND (s.km BETWEEN :fromkm - 0.0001 AND :tokm + 0.0001)"
+            + "    AND (p.tiefevon > 0.0) AND (p.tiefebis <= 0.5)"
+            + "    AND (t.datum BETWEEN :fromdate AND :todate)"
+            + " ORDER BY s.km ASC, a.d50 ASC";
 
     private Calculation problems;
 
@@ -103,12 +103,13 @@
         cal.set(soundingYear + validYears, 11, 31);
         final Date endTime = cal.getTime();
 
-        log.debug(String.format("loadValues km %.3f - %.3f %tF - %tF", kmRange.getMinimumDouble(), kmRange.getMaximumDouble(), startTime, endTime));
+        final String seddbRiver = river.nameForSeddb();
+        log.debug(String.format("loadValues '%s' km %.3f - %.3f %tF - %tF", seddbRiver, kmRange.getMinimumDouble(), kmRange.getMaximumDouble(), startTime,
+                endTime));
         final Session session = SedDBSessionHolder.HOLDER.get();
         final SQLQuery sqlQuery = session.createSQLQuery(SQL_BED_D50_SUBLAYER_MEASUREMENT).addScalar("km", StandardBasicTypes.DOUBLE)
                 .addScalar("datum", StandardBasicTypes.DATE).addScalar("tiefevon", StandardBasicTypes.DOUBLE).addScalar("tiefebis", StandardBasicTypes.DOUBLE)
                 .addScalar("d50", StandardBasicTypes.DOUBLE);
-        final String seddbRiver = river.nameForSeddb();
         sqlQuery.setString("name", seddbRiver);
         sqlQuery.setDouble("fromkm", kmRange.getMinimumDouble());
         sqlQuery.setDouble("tokm", kmRange.getMaximumDouble());

http://dive4elements.wald.intevation.org