Browse Source

fix error on task listing when not filtering on project ID.

main
Gisle Aune 4 years ago
parent
commit
a91b2a076a
  1. 3
      database/postgres/tasks.go

3
database/postgres/tasks.go

@ -57,14 +57,13 @@ func (r *taskRepository) ListWithLinks(ctx context.Context, filter models.TaskFi
sq = sq.Where(squirrel.Eq{"task.item_id": filter.ItemIDs}) sq = sq.Where(squirrel.Eq{"task.item_id": filter.ItemIDs})
} }
if filter.ProjectIDs != nil { if filter.ProjectIDs != nil {
sq = sq.LeftJoin("task_link AS tl ON task.task_id = tl.task_id")
sq = sq.Where(squirrel.Or{ sq = sq.Where(squirrel.Or{
squirrel.Eq{"task.project_id": filter.ProjectIDs}, squirrel.Eq{"task.project_id": filter.ProjectIDs},
squirrel.Eq{"tl.project_id": filter.ProjectIDs}, squirrel.Eq{"tl.project_id": filter.ProjectIDs},
}) })
} }
sq = sq.LeftJoin("task_link AS tl ON task.task_id = tl.task_id")
sq = sq.InnerJoin("project AS p ON task.project_id = p.project_id") sq = sq.InnerJoin("project AS p ON task.project_id = p.project_id")
sq = sq.OrderBy("active DESC", "status_tag ASC", "created_time") sq = sq.OrderBy("active DESC", "status_tag ASC", "created_time")

Loading…
Cancel
Save