changeset 2179:20d9b71f4125

Import queue listing: Add another column 'warnings' (bool) to listing output which indicates if an import has warnings or not.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 11 Feb 2019 13:04:36 +0100
parents 17bf4c05caa4
children 256f98e1d954 bd09d6ad4c14
files pkg/controllers/importqueue.go pkg/models/import.go
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/controllers/importqueue.go	Mon Feb 11 11:47:16 2019 +0100
+++ b/pkg/controllers/importqueue.go	Mon Feb 11 13:04:36 2019 +0100
@@ -39,7 +39,12 @@
   kind,
   username,
   signer,
-  summary
+  summary,
+  EXISTS (
+    SELECT true FROM import.import_logs
+      WHERE kind = 'warn'::log_type AND
+            import_id = import.imports.id
+  ) AS has_warnings
 FROM import.imports
 `
 
@@ -213,6 +218,7 @@
 			&it.User,
 			&signer,
 			&summary,
+			&it.Warnings,
 		); err != nil {
 			return
 		}
--- a/pkg/models/import.go	Mon Feb 11 11:47:16 2019 +0100
+++ b/pkg/models/import.go	Mon Feb 11 13:04:36 2019 +0100
@@ -30,6 +30,7 @@
 		User     string      `json:"user"`
 		Signer   string      `json:"signer,omitempty"`
 		Summary  interface{} `json:"summary,omitempty"`
+		Warnings bool        `json:"warnings,omitempty"`
 	}
 
 	ImportLogEntry struct {