# HG changeset patch # User Tom Gottfried # Date 1558712717 -7200 # Node ID aa3c83fb7018c0d123d7a5d484638c46d50584e6 # Parent 870812d8f2479e0284ec824d20b0ee5fe0fc39e0 Validate temporal validity of gauges on import Since we need the time range to identify gauge versions in the WHERE-clause of the first statement, validate before it touches the database to avoid a quite unspecific error due to invalid range input. diff -r 870812d8f247 -r aa3c83fb7018 pkg/imports/wg.go --- a/pkg/imports/wg.go Fri May 24 15:32:47 2019 +0200 +++ b/pkg/imports/wg.go Fri May 24 17:45:17 2019 +0200 @@ -235,6 +235,13 @@ gauges = append(gauges, isrs) feedback.Info("Processing %s", code) + // We need a valid time range to identify gauge versions in DB + if time.Time(*dr.Enddate).Before(time.Time(*dr.Startdate)) { + feedback.Warn("End date before start date. Ignored") + unchanged++ + continue + } + var from, to sql.NullInt64 if dr.Applicabilityfromkm != nil {