diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb index 2c56cb4c68006137e863887923a2d2f76ab61a27..b6e88b0280f228b2ebe4dc2f527ba3f63b785a94 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 0000000000000000000000000000000000000000..2046b6df11e32a172b89e1834d355bdacbc33635 --- /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