From d3f397b0360230cf5746eab68890d730e946965c Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 13 Jun 2024 16:35:47 +0200 Subject: [PATCH] fix(tasks): do not crash when order by id and position --- pkg/models/task_search.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/models/task_search.go b/pkg/models/task_search.go index 0b871f32f..d62a68072 100644 --- a/pkg/models/task_search.go +++ b/pkg/models/task_search.go @@ -58,6 +58,10 @@ func getOrderByDBStatement(opts *taskSearchOptions) (orderby string, err error) prefix = "task_positions." } + if param.sortBy == taskPropertyID { + prefix = "tasks." + } + // Mysql sorts columns with null values before ones without null value. // Because it does not have support for NULLS FIRST or NULLS LAST we work around this by // first sorting for null (or not null) values and then the order we actually want to.