Order Task list

This commit is contained in:
speatzle 2024-05-21 16:07:37 +02:00
parent 24ec424901
commit 34e962631d

View file

@ -62,7 +62,7 @@ func handleTasks(w http.ResponseWriter, r *http.Request) {
} }
data.Libraries = libraries data.Libraries = libraries
rows, err = db.Query(r.Context(), "SELECT t.id AS id, l.id AS library, t.worker_id AS worker, t.type AS type, t.status AS status, f.path AS file FROM tasks t INNER JOIN files f ON f.id = t.file_id INNER JOIN libraries l ON l.id = f.library_id") rows, err = db.Query(r.Context(), "SELECT t.id AS id, l.id AS library, t.worker_id AS worker, t.type AS type, t.status AS status, f.path AS file FROM tasks t INNER JOIN files f ON f.id = t.file_id INNER JOIN libraries l ON l.id = f.library_id ORDER BY CASE t.type WHEN 3 THEN -1 ELSE t.type END, t.id")
if err != nil { if err != nil {
slog.ErrorContext(r.Context(), "Query Tasks", "err", err) slog.ErrorContext(r.Context(), "Query Tasks", "err", err)
http.Error(w, "Error Query Tasks: "+err.Error(), http.StatusInternalServerError) http.Error(w, "Error Query Tasks: "+err.Error(), http.StatusInternalServerError)