Mercurial > gemma
comparison pkg/imports/gm.go @ 1775:fcb0106ec510
Gauge measurement import: Added reference_code column.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 11 Jan 2019 12:10:23 +0100 |
parents | 70c4dc694d61 |
children | 6a902363b435 |
comparison
equal
deleted
inserted
replaced
1774:f9ac2d4d2069 | 1775:fcb0106ec510 |
---|---|
56 measure_date, | 56 measure_date, |
57 sender, | 57 sender, |
58 language_code, | 58 language_code, |
59 country_code, | 59 country_code, |
60 date_issue, | 60 date_issue, |
61 reference_code, | |
61 water_level, | 62 water_level, |
62 predicted, | 63 predicted, |
63 is_waterlevel, | 64 is_waterlevel, |
64 value_min, | 65 value_min, |
65 value_max, | 66 value_max, |
76 $12, | 77 $12, |
77 $13, | 78 $13, |
78 $14, | 79 $14, |
79 $15, | 80 $15, |
80 $16, | 81 $16, |
81 $17 | 82 $17, |
83 $18 | |
82 ) | 84 ) |
83 RETURNING id` | 85 RETURNING id` |
84 ) | 86 ) |
85 | 87 |
86 type gmJobCreator struct{} | 88 type gmJobCreator struct{} |
259 for _, wrm := range msg.Wrm { | 261 for _, wrm := range msg.Wrm { |
260 currIsrs, err := models.IsrsFromString(string(*wrm.Geo_object.Id)) | 262 currIsrs, err := models.IsrsFromString(string(*wrm.Geo_object.Id)) |
261 if err != nil { | 263 if err != nil { |
262 feedback.Warn("Invalid ISRS code %v", err) | 264 feedback.Warn("Invalid ISRS code %v", err) |
263 continue | 265 continue |
266 } | |
267 var referenceCode string | |
268 if wrm.Reference_code == nil { | |
269 feedback.Info("'Reference_code' not specified. Assuming 'ZPG'") | |
270 referenceCode = "ZPG" | |
271 } else { | |
272 referenceCode = *wrm.Reference_code | |
264 } | 273 } |
265 for _, measure := range wrm.Measure { | 274 for _, measure := range wrm.Measure { |
266 var unit string | 275 var unit string |
267 if measure.Unit == nil { | 276 if measure.Unit == nil { |
268 feedback.Info("'Unit' not specified. Assuming 'cm'") | 277 feedback.Info("'Unit' not specified. Assuming 'cm'") |
285 measure.Measuredate, | 294 measure.Measuredate, |
286 msg.Identification.From, | 295 msg.Identification.From, |
287 msg.Identification.Language_code, | 296 msg.Identification.Language_code, |
288 msg.Identification.Country_code, | 297 msg.Identification.Country_code, |
289 msg.Identification.Date_issue, | 298 msg.Identification.Date_issue, |
299 referenceCode, | |
290 convert(measure.Value), | 300 convert(measure.Value), |
291 measure.Predicted, | 301 measure.Predicted, |
292 isWaterlevel, | 302 isWaterlevel, |
293 convert(measure.Value_min), | 303 convert(measure.Value_min), |
294 convert(measure.Value_max), | 304 convert(measure.Value_max), |