comparison pkg/imports/bn.go @ 1611:1835d1c9eb9b

Store bottleneck_id's instead of id's in bottleneck import summary.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 18 Dec 2018 11:53:53 +0100
parents f6596daf2079
children 6ee06eb37fa9
comparison
equal deleted inserted replaced
1610:2ee243f9a7ee 1611:1835d1c9eb9b
178 return nil, err 178 return nil, err
179 } 179 }
180 defer (*x.stmt).Close() 180 defer (*x.stmt).Close()
181 } 181 }
182 182
183 var nids []int64 183 var nids []string
184 184
185 start := time.Now() 185 start := time.Now()
186 186
187 nextBN: 187 nextBN:
188 for _, bn := range bns { 188 for _, bn := range bns {
229 bn.Source, 229 bn.Source,
230 ).Scan(&nid) 230 ).Scan(&nid)
231 if err != nil { 231 if err != nil {
232 return nil, err 232 return nil, err
233 } 233 }
234 nids = append(nids, nid) 234 nids = append(nids, bn.Bottleneck_id)
235 if _, err := trackStmt.ExecContext( 235 if _, err := trackStmt.ExecContext(
236 ctx, importID, "waterway.bottlenecks", nid, 236 ctx, importID, "waterway.bottlenecks", nid,
237 ); err != nil { 237 ); err != nil {
238 return nil, err 238 return nil, err
239 } 239 }
249 feedback.Info("Import of bottlenecks was successful") 249 feedback.Info("Import of bottlenecks was successful")
250 } 250 }
251 251
252 // TODO: needs to be filled more useful. 252 // TODO: needs to be filled more useful.
253 summary := struct { 253 summary := struct {
254 Bottlenecks []int64 `json:"bottlenecks"` 254 Bottlenecks []string `json:"bottlenecks"`
255 }{ 255 }{
256 Bottlenecks: nids, 256 Bottlenecks: nids,
257 } 257 }
258 return &summary, err 258 return &summary, err
259 } 259 }