diff options
author | Toon Claes <toon@gitlab.com> | 2017-04-21 11:36:34 +0200 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2017-04-27 09:57:09 +0200 |
commit | a204d14c672e08a825479511473ba3999ed08434 (patch) | |
tree | 05018866869b1119b38c71a668503e91797a733b /app/controllers | |
parent | d031665a634e5d6fef980e837d6b227097850178 (diff) | |
download | gitlab-ce-a204d14c672e08a825479511473ba3999ed08434.tar.gz |
Avoid plucking Todo ids and use sub-queries insteadtc-no-todo-service-select
TodoService should not call `.select(&:id)` on todos, because this is
bad performance. So instead use sub-queries, which will result in a
single SQL query to the database.
https://docs.gitlab.com/ee/development/sql.html#plucking-ids
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/dashboard/todos_controller.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb index 4d7d45787fc..2b76e57c06a 100644 --- a/app/controllers/dashboard/todos_controller.rb +++ b/app/controllers/dashboard/todos_controller.rb @@ -12,7 +12,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController end def destroy - TodoService.new.mark_todos_as_done_by_ids([params[:id]], current_user) + TodoService.new.mark_todos_as_done_by_ids(params[:id], current_user) respond_to do |format| format.html { redirect_to dashboard_todos_path, notice: 'Todo was successfully marked as done.' } @@ -32,7 +32,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController end def restore - TodoService.new.mark_todos_as_pending_by_ids([params[:id]], current_user) + TodoService.new.mark_todos_as_pending_by_ids(params[:id], current_user) render json: todos_counts end |