Mercurial > gemma
changeset 2092:f70f67eaa7aa
Waterway profile import: log warnings if no profile geometry can be found for ISRS code.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 01 Feb 2019 17:03:28 +0100 |
parents | 3f32b18bbd4c |
children | a9d28c489761 |
files | pkg/imports/wp.go |
diffstat | 1 files changed, 12 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/imports/wp.go Fri Feb 01 16:32:52 2019 +0100 +++ b/pkg/imports/wp.go Fri Feb 01 17:03:28 2019 +0100 @@ -28,11 +28,12 @@ "strings" "time" + "github.com/jackc/pgx/pgtype" + "gemma.intevation.de/gemma/pkg/common" "gemma.intevation.de/gemma/pkg/misc" "gemma.intevation.de/gemma/pkg/models" "gemma.intevation.de/gemma/pkg/wfs" - "github.com/jackc/pgx/pgtype" ) type WaterwayProfiles struct { @@ -126,7 +127,7 @@ $11, $12, $13 -) RETURNING id` +) RETURNING id, geom is NULL` wpStageDoneSQL = ` UPDATE waterway.waterway_profiles SET staging_done = true @@ -508,6 +509,8 @@ source := row[sourceIdx] var id int64 + var noGeom bool + if err := insertStmt.QueryRowContext( ctx, location.CountryCode, @@ -523,7 +526,7 @@ fe100, dateInfo, source, - ).Scan(&id); err != nil { + ).Scan(&id, &noGeom); err != nil { return nil, err } @@ -531,6 +534,12 @@ ctx, importID, "waterway.waterway_profiles", id); err != nil { return nil, err } + + if noGeom { + feedback.Warn( + "No profile geometry found for %s in line %d.", location, line) + } + ids = append(ids, id) } if len(ids) == 0 {