changeset 5726:3bed418476d8

Merged errors-in-csv-export
author Sascha Wilde <wilde@sha-bang.de>
date Wed, 17 Jan 2024 18:50:38 +0100
parents 4bfcbb747768 (current diff) 2a1eff7c4af0 (diff)
children 770681f87310
files
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/controllers/importqueue.go	Fri Dec 15 18:17:40 2023 +0100
+++ b/pkg/controllers/importqueue.go	Wed Jan 17 18:50:38 2024 +0100
@@ -74,6 +74,8 @@
   signer,
   EXISTS(SELECT 1 FROM import.import_logs
     WHERE kind = 'warn'::log_type and import_id = id) AS has_warnings,
+  EXISTS(SELECT 1 FROM import.import_logs
+    WHERE kind = 'error'::log_type and import_id = id) AS has_errors,
   data,
   CASE WHEN kind = ANY($1) THEN ARRAY(SELECT msg FROM import.import_logs WHERE import_id = id)
   ELSE NULL
@@ -311,6 +313,7 @@
 		"#signer",
 		"#state",
 		"#warnings",
+		"#errors",
 		"#source",
 	}
 
@@ -346,6 +349,7 @@
 		country  string
 		signer   sql.NullString
 		warnings bool
+		errors   bool
 		data     string
 		msgs     pgtype.TextArray
 	}
@@ -395,7 +399,8 @@
 		record[6] = signer
 		record[7] = ds.state
 		record[8] = strconv.FormatBool(ds.warnings)
-		record[9] = description
+		record[9] = strconv.FormatBool(ds.errors)
+		record[10] = description
 
 		return out.Write(record)
 	}
@@ -413,6 +418,7 @@
 			&curr.country,
 			&curr.signer,
 			&curr.warnings,
+			&curr.errors,
 			&curr.data,
 			&curr.msgs,
 		); err != nil {