diff options
Diffstat (limited to 'app/services/todo_service.rb')
-rw-r--r-- | app/services/todo_service.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb index eb833dd82ac..daf4339cb48 100644 --- a/app/services/todo_service.rb +++ b/app/services/todo_service.rb @@ -142,7 +142,11 @@ class TodoService # When user marks some todos as done def mark_todos_as_done(todos, current_user) - todos = current_user.todos.where(id: todos.map(&:id)) unless todos.respond_to?(:update_all) + mark_todos_as_done_by_ids(todos.select(&:id), current_user) + end + + def mark_todos_as_done_by_ids(ids, current_user) + todos = current_user.todos.where(id: ids) marked_todos = todos.update_all(state: :done) current_user.update_todos_count_cache |