summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/services/todo_service.rb2
-rw-r--r--changelogs/unreleased/todo-update-order.yml4
2 files changed, 5 insertions, 1 deletions
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb
index 2c56cb4c680..b6e88b0280f 100644
--- a/app/services/todo_service.rb
+++ b/app/services/todo_service.rb
@@ -204,7 +204,7 @@ class TodoService
# Only update those that are not really on that state
todos = todos.where.not(state: state)
todos_ids = todos.pluck(:id)
- todos.update_all(state: state)
+ todos.unscope(:order).update_all(state: state)
current_user.update_todos_count_cache
todos_ids
end
diff --git a/changelogs/unreleased/todo-update-order.yml b/changelogs/unreleased/todo-update-order.yml
new file mode 100644
index 00000000000..2046b6df11e
--- /dev/null
+++ b/changelogs/unreleased/todo-update-order.yml
@@ -0,0 +1,4 @@
+---
+title: Remove unnecessary ORDER BY clause when updating todos
+merge_request:
+author: mhasbini