changeset 5298:4bc14bea3fc9

Fixed check for bottleneck existence in fa import. The contains() function for bottleneck lists (slice) is build upon sort.SearchStrings() which in turn requires the slice to be sorted. Until now the bottleneck list was sorted by ordering in the database request, which depends on LC_COLLATE and might not meet the sort packages expectations. Therefor we now use sort.Strings() to sort it based on the same semantics as expected by SearchStrings().
author wilde@azure1.rgb.intevation.de
date Wed, 11 Nov 2020 10:57:22 +0100
parents 3872f3bd1a08
children 1beb407cf7d0
files pkg/imports/fa.go
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/imports/fa.go	Thu Jul 09 17:26:53 2020 +0200
+++ b/pkg/imports/fa.go	Wed Nov 11 10:57:22 2020 +0100
@@ -4,7 +4,7 @@
 // SPDX-License-Identifier: AGPL-3.0-or-later
 // License-Filename: LICENSES/AGPL-3.0.txt
 //
-// Copyright (C) 2018,2019 by via donau
+// Copyright (C) 2018,2019,2020 by via donau
 //   – Österreichische Wasserstraßen-Gesellschaft mbH
 // Software engineering by Intevation GmbH
 //
@@ -58,7 +58,6 @@
     SELECT country FROM users.list_users WHERE username = current_user)
   AND staging_done = true
   AND validity && $1
-ORDER BY bottleneck_id
 `
 
 	latestMeasureDateSQL = `
@@ -235,6 +234,9 @@
 		return nil, err
 	}
 
+	// bottlenecks MUST be sorted according to the sort packages
+	// expectations for contains() to work
+	sort.Strings(bns)
 	return bns, nil
 }