[PATCH 2 of 5] Fixed getPeer for depth. Select with a small epsilon, not extact match

Wald Commits scm-commit at wald.intevation.org
Thu May 8 13:52:55 CEST 2014


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1399549592 -7200
# Node ID c288309a5dcbb24d9b641ea6953e3f13081c07b4
# Parent  f4dffc7d1d60f94bd7db1d75a1141bf9066c3ef5
Fixed getPeer for depth. Select with a small epsilon, not extact match.

diff -r f4dffc7d1d60 -r c288309a5dcb backend/src/main/java/org/dive4elements/river/importer/ImportDepth.java
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportDepth.java	Thu May 08 13:45:23 2014 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportDepth.java	Thu May 08 13:46:32 2014 +0200
@@ -52,11 +52,11 @@
 
             Query query = session.createQuery(
                 "from Depth where " +
-                "   lower=:lower and " +
-                "   upper=:upper");
+                "   lower between :lower - 0.0001f and :lower + 0.00001f and " +
+                "   upper between :upper - 0.0001f and :upper + 0.00001f");
 
-            query.setParameter("lower", lower);
-            query.setParameter("upper", upper);
+            query.setParameter("lower", lower.floatValue());
+            query.setParameter("upper", upper.floatValue());
 
             List<Depth> depths = query.list();
 


More information about the Dive4Elements-commits mailing list