Mercurial > gemma
changeset 4072:1eb39e9e8ec2 historization_ng
Adapted fwa-import to new historization model.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Thu, 25 Jul 2019 14:48:38 +0200 |
parents | 4332b9e26e2f |
children | 21854740f433 |
files | pkg/imports/fa.go |
diffstat | 1 files changed, 9 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/imports/fa.go Thu Jul 25 13:20:32 2019 +0200 +++ b/pkg/imports/fa.go Thu Jul 25 14:48:38 2019 +0200 @@ -4,13 +4,14 @@ // SPDX-License-Identifier: AGPL-3.0-or-later // License-Filename: LICENSES/AGPL-3.0.txt // -// Copyright (C) 2018 by via donau +// Copyright (C) 2018,2019 by via donau // – Österreichische Wasserstraßen-Gesellschaft mbH // Software engineering by Intevation GmbH // // Author(s): // * Raimund Renkert <raimund.renkert@intevation.de> // * Sascha L. Teichmann <sascha.teichmann@intevation.de> +// * Sascha Wilde <wilde@intevation.de> package imports @@ -63,11 +64,10 @@ ` listFairwayAvailabilitySQL = ` SELECT - fa.id, - bn.bottleneck_id, - fa.surdat -FROM waterway.fairway_availability fa -JOIN waterway.bottlenecks bn ON bn.id = fa.bottleneck_id + id, + bottleneck_id, + surdat +FROM waterway.fairway_availability ` insertFASQL = ` INSERT INTO waterway.fairway_availability ( @@ -79,10 +79,7 @@ source_organization ) VALUES ( $1, - -- Always associate fairway availability data to newest bottleneck - -- version to prevent problems in analysis over longer time periods - (SELECT id FROM waterway.bottlenecks WHERE bottleneck_id = $2 - ORDER BY validity DESC FETCH FIRST ROW ONLY), + $2, $3, $4, $5, @@ -351,6 +348,8 @@ var faID int64 feedback.Info("Found %d fairway availabilities", len(fas)) for _, faRes := range fas { + // FIXME: The following test is propably unneccessary as already + // done by DB constraints... [sw] if !bnIds.contains(faRes.Bottleneck_id) { feedback.Warn("Bottleneck %s not found in database.", faRes.Bottleneck_id) continue