diff --git a/db/tasks.go b/db/tasks.go index 2e7df69..76618b8 100644 --- a/db/tasks.go +++ b/db/tasks.go @@ -118,12 +118,12 @@ func GetTaskByID(id int) (types.Context, error) { var tasks []types.Task var task types.Task - getTasksql := "select id, title, content, priority from task where id=?" + getTasksql := "select t.id, t.title, t.content, t.priority, c.name from task t left outer join category c where c.id = t.cat_id and t.id=?" rows := database.query(getTasksql, id) defer rows.Close() if rows.Next() { - err := rows.Scan(&task.Id, &task.Title, &task.Content, &task.Priority) + err := rows.Scan(&task.Id, &task.Title, &task.Content, &task.Priority, &task.Category) if err != nil { log.Println(err) //send email to respective people diff --git a/templates/edit.html b/templates/edit.html index c2be11f..10fc37d 100644 --- a/templates/edit.html +++ b/templates/edit.html @@ -3,24 +3,31 @@ + {{ $categories := .Categories }} + {{range $index, $task := .Tasks}}