Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-04-21 12:36:34 +0300
committerToon Claes <toon@iotcl.com>2017-08-03 17:31:05 +0300
commita723cba57493ec3220596ca8543a8b1b1ec118fe (patch)
treefc1048fe60a21339cef711caf69aff59edf5a5fb /app/controllers/dashboard/todos_controller.rb
parentc39daf937bd62eedcbe7e3b44f107bb7e87452e7 (diff)
Avoid plucking Todo ids and use sub-queries instead
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/dashboard/todos_controller.rb')
-rw-r--r--app/controllers/dashboard/todos_controller.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb
index 59e5b5e4775..a8b2b93b458 100644
--- a/app/controllers/dashboard/todos_controller.rb
+++ b/app/controllers/dashboard/todos_controller.rb
@@ -13,7 +13,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 do
@@ -37,7 +37,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