diff --git a/db/tasks.go b/db/tasks.go index a0e5a44..5c45196 100644 --- a/db/tasks.go +++ b/db/tasks.go @@ -330,12 +330,12 @@ func GetComments(username string) (map[int][]types.Comment, error) { if err != nil { return commentMap, err } - stmt := "select c.id, c.taskID, c.content, c.created from comments c, task t where t.id=c.taskID and c.user_id=?;" + stmt := "select c.id, c.taskID, c.content, c.created, u.username from comments c, task t, user u where t.id=c.taskID and c.user_id=t.user_id and t.user_id=u.id and u.id=?" rows := database.query(stmt, userID) defer rows.Close() for rows.Next() { - err := rows.Scan(&comment.ID, &taskID, &comment.Content, &created) + err := rows.Scan(&comment.ID, &taskID, &comment.Content, &created, &comment.Username) if err != nil { return commentMap, err } diff --git a/templates/home.html b/templates/home.html index 8dc1d00..f587fcc 100644 --- a/templates/home.html +++ b/templates/home.html @@ -60,7 +60,7 @@ {{range $value.Comments}}