fix Unassinged Tasks not showing up
This commit is contained in:
parent
7afef6234a
commit
bf8b996a01
1 changed files with 3 additions and 3 deletions
|
@ -54,7 +54,7 @@ type TasksDisplay struct {
|
|||
type TaskDisplay struct {
|
||||
ID int
|
||||
Library string
|
||||
Worker string
|
||||
Worker *string
|
||||
Type string
|
||||
Status string
|
||||
Filename string
|
||||
|
@ -178,7 +178,7 @@ func handleTasks(w http.ResponseWriter, r *http.Request) {
|
|||
data.Page = uint(page)
|
||||
}
|
||||
|
||||
rows, err = db.Query(r.Context(), "SELECT t.id AS id, l.id AS library, w.name AS worker, t.type AS type, fc.name AS ffmpeg_command, t.status AS status, f.path AS file, t.updated_at AS updated_at FROM tasks t INNER JOIN files f ON f.id = t.file_id INNER JOIN libraries l ON l.id = f.library_id INNER JOIN ffmpeg_commands fc ON fc.id = t.ffmpeg_command_id INNER JOIN workers w ON t.worker_id = w.id "+fmt.Sprintf("ORDER BY %v %v LIMIT %d OFFSET %d", data.OrderBy, orderDir, data.Limit, data.Page*data.Limit))
|
||||
rows, err = db.Query(r.Context(), "SELECT t.id AS id, l.id AS library, w.name AS worker, t.type AS type, fc.name AS ffmpeg_command, t.status AS status, f.path AS file, t.updated_at AS updated_at FROM tasks t INNER JOIN files f ON f.id = t.file_id INNER JOIN libraries l ON l.id = f.library_id INNER JOIN ffmpeg_commands fc ON fc.id = t.ffmpeg_command_id LEFT JOIN workers w ON t.worker_id = w.id "+fmt.Sprintf("ORDER BY %v %v LIMIT %d OFFSET %d", data.OrderBy, orderDir, data.Limit, data.Page*data.Limit))
|
||||
if err != nil {
|
||||
slog.ErrorContext(r.Context(), "Query Tasks", "err", err)
|
||||
http.Error(w, "Error Query Tasks: "+err.Error(), http.StatusInternalServerError)
|
||||
|
@ -228,7 +228,7 @@ func handleTask(w http.ResponseWriter, r *http.Request) {
|
|||
var typ constants.TaskType
|
||||
var status constants.TaskStatus
|
||||
t := TaskDisplay{}
|
||||
err := db.QueryRow(r.Context(), "SELECT t.id, l.name, w.name, t.type, t.status, f.path, t.log, t.updated_at FROM tasks t INNER JOIN workers w ON w.id = t.worker_id INNER JOIN files f ON f.id = t.file_id INNER JOIN libraries l ON l.id = f.library_id WHERE t.id = $1", id).Scan(&t.ID, &t.Library, &t.Worker, &typ, &status, &t.Filename, &t.Log, &t.UpdatedAt)
|
||||
err := db.QueryRow(r.Context(), "SELECT t.id, l.name, w.name, t.type, t.status, f.path, t.log, t.updated_at FROM tasks t LEFT JOIN workers w ON w.id = t.worker_id INNER JOIN files f ON f.id = t.file_id INNER JOIN libraries l ON l.id = f.library_id WHERE t.id = $1", id).Scan(&t.ID, &t.Library, &t.Worker, &typ, &status, &t.Filename, &t.Log, &t.UpdatedAt)
|
||||
if err != nil {
|
||||
slog.ErrorContext(r.Context(), "Query Tasks", "err", err)
|
||||
http.Error(w, "Error Query Tasks: "+err.Error(), http.StatusInternalServerError)
|
||||
|
|
Loading…
Add table
Reference in a new issue