From 2332bf34ac417bb8a0aaba9482379bcfadb6d26e Mon Sep 17 00:00:00 2001 From: mhasbini Date: Sun, 2 Apr 2017 20:48:58 +0300 Subject: Remove unnecessary ORDER BY clause when updating todos --- app/services/todo_service.rb | 2 +- changelogs/unreleased/todo-update-order.yml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/todo-update-order.yml 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 -- cgit v1.2.1