changeset 2231:97bba8b51b9c

Stretch import: Be more verbose about range before inserting data.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 13 Feb 2019 11:13:06 +0100
parents 4374d942b23d
children 7936b46a88d4
files pkg/imports/st.go pkg/models/common.go
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/imports/st.go	Wed Feb 13 10:52:14 2019 +0100
+++ b/pkg/imports/st.go	Wed Feb 13 11:13:06 2019 +0100
@@ -170,6 +170,8 @@
 		nobjnm = sql.NullString{String: *st.NObjNam, Valid: true}
 	}
 
+	feedback.Info("Stretch from %s to %s.", st.From, st.To)
+
 	var id int64
 	if err := tx.QueryRowContext(
 		ctx,
@@ -194,6 +196,8 @@
 	}
 
 	// store the associated countries.
+
+	feedback.Info("Countries associated with stretch: %s.", st.Countries)
 	for _, c := range st.Countries {
 		if _, err := insertCountryStmt.ExecContext(ctx, id, c); err != nil {
 			return nil, err
--- a/pkg/models/common.go	Wed Feb 13 10:52:14 2019 +0100
+++ b/pkg/models/common.go	Wed Feb 13 11:13:06 2019 +0100
@@ -128,3 +128,14 @@
 	*uc = countries
 	return nil
 }
+
+func (uc UniqueCountries) String() string {
+	var b strings.Builder
+	for i, c := range uc {
+		if i > 0 {
+			b.WriteString(", ")
+		}
+		b.WriteString(string(c))
+	}
+	return b.String()
+}