changeset 5880:1f52b2bff737

Another part of flys/issue1247: Now the main values are determined right if the gauge limits are in abitrary order.
author Sascha L. Teichmann <teichmann@intevation.de>
date Mon, 29 Apr 2013 17:23:12 +0200
parents 895b80728095
children 1afeb674381d
files backend/src/main/java/org/dive4elements/river/model/River.java
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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));

http://dive4elements.wald.intevation.org