summaryrefslogtreecommitdiff
path: root/app/controllers/projects/todos_controller.rb
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-06-02 15:46:58 +0200
committerPaco Guzman <pacoguzmanp@gmail.com>2016-06-17 19:04:36 +0200
commitf6bfa46daae3a00ca6f74abb6e6eddc9eac96197 (patch)
treee80a1c3cde48387c034dbec51636b8d2c5277873 /app/controllers/projects/todos_controller.rb
parentfcd9f90641d5ee59cc84d8388b7cc372370ac25a (diff)
downloadgitlab-ce-f6bfa46daae3a00ca6f74abb6e6eddc9eac96197.tar.gz
Cache todo counters (pending/done)18034-cache-todo-counter
- As todos are created/updated inside the TodoService we repopulate the cache just there for both pending/done todos - Todos as mark as done from the TodosController we update cache there too - All the added methods are kept in the User class for cohesion
Diffstat (limited to 'app/controllers/projects/todos_controller.rb')
-rw-r--r--app/controllers/projects/todos_controller.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/projects/todos_controller.rb b/app/controllers/projects/todos_controller.rb
index a51bd5e2b49..648d42c56c5 100644
--- a/app/controllers/projects/todos_controller.rb
+++ b/app/controllers/projects/todos_controller.rb
@@ -4,7 +4,7 @@ class Projects::TodosController < Projects::ApplicationController
render json: {
todo: todos,
- count: current_user.todos.pending.count,
+ count: current_user.todos_pending_count,
}
end
@@ -12,7 +12,7 @@ class Projects::TodosController < Projects::ApplicationController
current_user.todos.find_by_id(params[:id]).update(state: :done)
render json: {
- count: current_user.todos.pending.count,
+ count: current_user.todos_pending_count,
}
end