Mercurial > gemma
comparison pkg/controllers/importqueue.go @ 5717:1c3bdd114ca1 errors-in-csv-export
Add errors column to CSV export.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 11 Dec 2023 16:16:57 +0100 |
parents | ceecc205011c |
children | 5a0fbdda6e2d |
comparison
equal
deleted
inserted
replaced
5669:6bf942f486e9 | 5717:1c3bdd114ca1 |
---|---|
72 (SELECT country FROM users.list_users lu | 72 (SELECT country FROM users.list_users lu |
73 WHERE lu.username = import.imports.username) AS country, | 73 WHERE lu.username = import.imports.username) AS country, |
74 signer, | 74 signer, |
75 EXISTS(SELECT 1 FROM import.import_logs | 75 EXISTS(SELECT 1 FROM import.import_logs |
76 WHERE kind = 'warn'::log_type and import_id = id) AS has_warnings, | 76 WHERE kind = 'warn'::log_type and import_id = id) AS has_warnings, |
77 EXISTS(SELECT 1 FROM import.import_logs | |
78 WHERE kind = 'error'::log_type and import_id = id) AS has_errors, | |
77 data, | 79 data, |
78 CASE WHEN kind = ANY($1) THEN ARRAY(SELECT msg FROM import.import_logs WHERE import_id = id) | 80 CASE WHEN kind = ANY($1) THEN ARRAY(SELECT msg FROM import.import_logs WHERE import_id = id) |
79 ELSE NULL | 81 ELSE NULL |
80 END AS msgs | 82 END AS msgs |
81 FROM import.imports | 83 FROM import.imports |
309 "#user", | 311 "#user", |
310 "#country", | 312 "#country", |
311 "#signer", | 313 "#signer", |
312 "#state", | 314 "#state", |
313 "#warnings", | 315 "#warnings", |
316 "#errors", | |
314 "#source", | 317 "#source", |
315 } | 318 } |
316 | 319 |
317 if err := out.Write(record); err != nil { | 320 if err := out.Write(record); err != nil { |
318 // Too late for HTTP status message. | 321 // Too late for HTTP status message. |
344 kind string | 347 kind string |
345 user string | 348 user string |
346 country string | 349 country string |
347 signer sql.NullString | 350 signer sql.NullString |
348 warnings bool | 351 warnings bool |
352 errors bool | |
349 data string | 353 data string |
350 msgs pgtype.TextArray | 354 msgs pgtype.TextArray |
351 } | 355 } |
352 | 356 |
353 // Log unsupported description interfaces per kind only once. | 357 // Log unsupported description interfaces per kind only once. |
393 record[4] = ds.user | 397 record[4] = ds.user |
394 record[5] = ds.country | 398 record[5] = ds.country |
395 record[6] = signer | 399 record[6] = signer |
396 record[7] = ds.state | 400 record[7] = ds.state |
397 record[8] = strconv.FormatBool(ds.warnings) | 401 record[8] = strconv.FormatBool(ds.warnings) |
398 record[9] = description | 402 record[9] = strconv.FormatBool(ds.errors) |
403 record[10] = description | |
399 | 404 |
400 return out.Write(record) | 405 return out.Write(record) |
401 } | 406 } |
402 | 407 |
403 for rows.Next() { | 408 for rows.Next() { |
411 &curr.kind, | 416 &curr.kind, |
412 &curr.user, | 417 &curr.user, |
413 &curr.country, | 418 &curr.country, |
414 &curr.signer, | 419 &curr.signer, |
415 &curr.warnings, | 420 &curr.warnings, |
421 &curr.errors, | |
416 &curr.data, | 422 &curr.data, |
417 &curr.msgs, | 423 &curr.msgs, |
418 ); err != nil { | 424 ); err != nil { |
419 log.Errorf("%v\n", err) | 425 log.Errorf("%v\n", err) |
420 return | 426 return |