Mercurial > gemma
diff pkg/controllers/importqueue.go @ 4196:948e312e87bc
Add flag and filter for imports having errors
Items in the list of imports gain a boolean attribute 'errors' set to
true, if the logs of an import contain any errors.
Using the parameter 'errors=true' in the request to get the list of
imports leads to only entries with errors being returned.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 14 Aug 2019 16:55:46 +0200 |
parents | ad13c581de7c |
children | 1458c9b0fdaa |
line wrap: on
line diff
--- a/pkg/controllers/importqueue.go Wed Aug 14 14:56:35 2019 +0200 +++ b/pkg/controllers/importqueue.go Wed Aug 14 16:55:46 2019 +0200 @@ -48,6 +48,8 @@ signer, summary IS NOT NULL AS has_summary, EXISTS(SELECT 1 FROM import.import_logs + WHERE kind = 'error'::log_type and import_id = imports.id) AS has_errors, + EXISTS(SELECT 1 FROM import.import_logs WHERE kind = 'warn'::log_type and import_id = imports.id) AS has_warnings FROM import.imports WHERE @@ -155,6 +157,12 @@ WHERE kind = 'warn'::log_type and import_id = imports.id)`) } + switch errors := strings.ToLower(req.FormValue("errors")); errors { + case "1", "t", "true": + cond(` EXISTS(SELECT 1 FROM import.import_logs + WHERE kind = 'error'::log_type and import_id = imports.id)`) + } + fl := &filledStmt{} fa := &filledStmt{} fb := &filledStmt{} @@ -273,6 +281,7 @@ &it.User, &signer, &it.Summary, + &it.Errors, &it.Warnings, ); err != nil { return