From 04a6a2a250bb180a1d2b59a46b1d2d81009bb75b Mon Sep 17 00:00:00 2001 From: aignatov-bio Date: Thu, 23 Jul 2020 11:35:22 +0200 Subject: [PATCH] Small fixes --- app/controllers/my_modules_controller.rb | 4 ++-- app/helpers/my_modules_helper.rb | 5 ----- config/initializers/constants.rb | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/controllers/my_modules_controller.rb b/app/controllers/my_modules_controller.rb index f388326b0..ded8bbe71 100644 --- a/app/controllers/my_modules_controller.rb +++ b/app/controllers/my_modules_controller.rb @@ -6,7 +6,6 @@ class MyModulesController < ApplicationController include Rails.application.routes.url_helpers include ActionView::Helpers::UrlHelper include ApplicationHelper - include MyModulesHelper before_action :load_vars before_action :load_projects_tree, only: %i(protocols results activities archive) @@ -246,7 +245,8 @@ class MyModulesController < ApplicationController .experiment .project .team) - @results = ordered_result_of(@my_module, params[:page]) + @results = @my_module.results.where(archived: false).page(params[:page]) + .per(Constants::RESULTS_PER_PAGE_LIMIT).order(created_at: :desc) end def archive diff --git a/app/helpers/my_modules_helper.rb b/app/helpers/my_modules_helper.rb index a82c31a4b..a0a5112c0 100644 --- a/app/helpers/my_modules_helper.rb +++ b/app/helpers/my_modules_helper.rb @@ -33,11 +33,6 @@ module MyModulesHelper my_module.samples.count end - def ordered_result_of(my_module, page) - page ||= 1 - my_module.results.where(archived: false).page(page).per(Constants::RESULTS_SEARCH_LIMIT).order(created_at: :desc) - end - def get_task_alert_color(my_module) alert = '' if !my_module.completed? diff --git a/config/initializers/constants.rb b/config/initializers/constants.rb index 238f1e350..999d4f4ef 100644 --- a/config/initializers/constants.rb +++ b/config/initializers/constants.rb @@ -65,7 +65,7 @@ class Constants # Max characters for repository name in Atwho modal ATWHO_REP_NAME_LIMIT = 16 # Results limited query/display elements for pages - RESULTS_SEARCH_LIMIT = 10 + RESULTS_PER_PAGE_LIMIT = 10 #============================================================================= # File and data memory size