From 4f3726057146beeccdf971ee00787b297bfde08f Mon Sep 17 00:00:00 2001 From: Mojca Lorber Date: Tue, 3 Mar 2020 16:17:29 +0100 Subject: [PATCH] Fix controller --- app/controllers/dashboard/current_tasks_controller.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/dashboard/current_tasks_controller.rb b/app/controllers/dashboard/current_tasks_controller.rb index 9576c2a59..1093eb986 100644 --- a/app/controllers/dashboard/current_tasks_controller.rb +++ b/app/controllers/dashboard/current_tasks_controller.rb @@ -36,10 +36,9 @@ module Dashboard end page = (params[:page] || 1).to_i - tasks_per_page = tasks.page(page).per(Constants::INFINITE_SCROLL_LIMIT) + tasks = tasks.with_step_statistics.preload(experiment: :project).page(page).per(Constants::INFINITE_SCROLL_LIMIT) - tasks_per_page = tasks_per_page.with_step_statistics.preload(experiment: :project) - tasks_list = tasks_per_page.map do |task| + tasks_list = tasks.map do |task| { id: task.id, link: protocols_my_module_path(task.id), experiment: escape_input(task.experiment.name), @@ -53,7 +52,7 @@ module Dashboard percentage: task.steps_completed_percentage } } end - render json: { data: tasks_list, next_page: tasks_per_page.next_page } + render json: { data: tasks_list, next_page: tasks.next_page } end def project_filter