From ec645f61625d51689264cfa7689270358619dce7 Mon Sep 17 00:00:00 2001 From: speatzle Date: Tue, 28 May 2024 21:09:26 +0200 Subject: [PATCH] Task Creation add Health Filter --- server/task.go | 5 +++-- tmpl/tasks.tmpl | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/server/task.go b/server/task.go index 9e63980..23bf2a7 100644 --- a/server/task.go +++ b/server/task.go @@ -169,10 +169,11 @@ func createTask(ctx context.Context, r *http.Request) error { return fmt.Errorf("Parseing Form: %w", err) } library := r.FormValue("library") + health := r.FormValue("health") typ := r.FormValue("type") - slog.Info("Got Task Create", "library", library, "type", typ) + slog.Info("Got Task Create", "library", library, "health", health, "type", typ) - rows, err := db.Query(r.Context(), "SELECT id, path, size, status, health, md5 FROM files where library_id = $1 AND status = $2", library, constants.FILE_STATUS_EXISTS) + rows, err := db.Query(r.Context(), "SELECT id, path, size, status, health, md5 FROM files where library_id = $1 AND status = $2 AND (-1 = $3 OR health = $3)", library, constants.FILE_STATUS_EXISTS, health) if err != nil { return fmt.Errorf("Query Files: %w", err) } diff --git a/tmpl/tasks.tmpl b/tmpl/tasks.tmpl index bced8e4..7a2d629 100644 --- a/tmpl/tasks.tmpl +++ b/tmpl/tasks.tmpl @@ -7,6 +7,13 @@ {{end}}
+
+