[Dive4elements-commits] [PATCH 2 of 2] issue1267: Polishing: Move the sorting into the db/sql-query

Wald Commits scm-commit at wald.intevation.org
Tue Jun 11 12:09:57 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1370945941 -7200
# Node ID 44ee7d26eb18de23ff5bc2fe829b82301a82b306
# Parent  5b1cc816fcdb138a6368dedbb9787c2fc9584423
issue1267: Polishing: Move the sorting into the db/sql-query.

diff -r 5b1cc816fcdb -r 44ee7d26eb18 artifacts/src/main/java/org/dive4elements/river/artifacts/model/FastCrossSectionChunk.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FastCrossSectionChunk.java	Tue Jun 11 12:05:01 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FastCrossSectionChunk.java	Tue Jun 11 12:19:01 2013 +0200
@@ -56,9 +56,6 @@
     /** Finds the FastCrossSectionLine at km (null if not found). */
     public FastCrossSectionLine getCrossSectionLine(double km) {
         FastCrossSectionLine key = new FastCrossSectionLine(km);
-        // TODO follwing is braindead. Create the list in sorted fashion
-        // instead and remove sorting here.
-        Collections.sort(crossSectionLines, FastCrossSectionLine.KM_CMP);
         int pos = Collections.binarySearch(
             crossSectionLines, key, FastCrossSectionLine.KM_CMP);
         return pos < 0 ? null : crossSectionLines.get(pos);
diff -r 5b1cc816fcdb -r 44ee7d26eb18 backend/src/main/java/org/dive4elements/river/model/CrossSection.java
--- a/backend/src/main/java/org/dive4elements/river/model/CrossSection.java	Tue Jun 11 12:05:01 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/model/CrossSection.java	Tue Jun 11 12:19:01 2013 +0200
@@ -51,7 +51,7 @@
         "ON csp.cross_section_line_id = csl.id " +
         "WHERE csl.cross_section_id = :cs_id AND " +
         "km between :from_km AND :to_km " +
-        "ORDER BY csl.id, csp.col_pos";
+        "ORDER BY csl.km, csl.id, csp.col_pos";
 
     private Integer                id;
     private River                  river;


More information about the Dive4elements-commits mailing list