[PATCH 1 of 2] issue1157: Only look at the best match for CrossSections to activate

Wald Commits scm-commit at wald.intevation.org
Mon Aug 19 10:19:49 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1376900346 -7200
# Node ID d02ad36115c675f13fb00dea97eb2f83ad424962
# Parent  b0c88ac9f63bbbcfbadcc65178fe1aa32d92238b
issue1157: Only look at the best match for CrossSections to activate.

diff -r b0c88ac9f63b -r d02ad36115c6 backend/src/main/java/org/dive4elements/river/model/CrossSection.java
--- a/backend/src/main/java/org/dive4elements/river/model/CrossSection.java	Sat Aug 17 20:08:51 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/model/CrossSection.java	Mon Aug 19 10:19:06 2013 +0200
@@ -241,11 +241,19 @@
 
         List<Integer> results = sqlQuery.list();
 
-        for (Integer result: results) {
+        if (results.size() >= 1) {
+            Integer result = results.get(0);
             if (result == getId()) {
                 return true;
             }
         }
+        else {
+            logger.warn("No CS found that could be master.");
+        }
+
+        // TODO If there is none, might need a fallback.
+        // Formerly this was the most current CS (issue1157).
+
         return false;
     }
 }


More information about the Dive4elements-commits mailing list