summaryrefslogtreecommitdiff
path: root/app/services/todo_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/todo_service.rb')
-rw-r--r--app/services/todo_service.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb
index 8787a1c93a9..bf7e76ec59e 100644
--- a/app/services/todo_service.rb
+++ b/app/services/todo_service.rb
@@ -201,10 +201,12 @@ class TodoService
def update_todos_state_by_ids(ids, current_user, state)
todos = current_user.todos.where(id: ids)
- # Only return those that are not really on that state
- marked_todos = todos.where.not(state: state).update_all(state: state)
+ # 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)
current_user.update_todos_count_cache
- marked_todos
+ todos_ids
end
def create_todos(users, attributes)