[Dive4elements-commits] [PATCH] Another part of flys/issue1247: Now the main values are determined right if the gauge limits are in abitrary order

Wald Commits scm-commit at wald.intevation.org
Mon Apr 29 17:23:16 CEST 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1367248992 -7200
# Node ID 1f52b2bff737f62c8ee083a4b7b84014ee137f25
# Parent  895b80728095318bdd048917c2e7a1a8566d53d2
Another part of flys/issue1247: Now the main values are determined right if the gauge limits are in abitrary order.

diff -r 895b80728095 -r 1f52b2bff737 backend/src/main/java/org/dive4elements/river/model/River.java
--- a/backend/src/main/java/org/dive4elements/river/model/River.java	Mon Apr 29 16:04:14 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/model/River.java	Mon Apr 29 17:23:12 2013 +0200
@@ -175,7 +175,10 @@
 
         Query query = session.createQuery(
             "from Gauge where river=:river " +
-            "and not (range.a > :b or range.b < :a) order by a");
+            "and not " + 
+            "((:b < least(range.a, range.b)) or" +
+            " (:a > greatest(range.a, range.b)))" + 
+            "order by a");
         query.setParameter("river", this);
         query.setParameter("a", new BigDecimal(a, PRECISION));
         query.setParameter("b", new BigDecimal(b, PRECISION));


More information about the Dive4elements-commits mailing list