From c8d170f9eca8718184dcfb2c2fbd9504be8410a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Zrim=C5=A1ek?= Date: Thu, 4 Oct 2018 21:48:15 +0200 Subject: [PATCH] Add default page size when it's not in request params when fetching projects --- app/services/projects_overview_service.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/services/projects_overview_service.rb b/app/services/projects_overview_service.rb index 49a5756f9..b2a2806cc 100644 --- a/app/services/projects_overview_service.rb +++ b/app/services/projects_overview_service.rb @@ -40,7 +40,11 @@ class ProjectsOverviewService def projects_datatable table_state = @view_state.state.dig('projects', 'table') - per_page = @params[:length] == '-1' ? 10 : @params[:length].to_i + per_page = if @params[:length] && @params[:length] != '-1' + @params[:length].to_i + else + 10 + end table_state['length'] = per_page if table_state['length'] != per_page page = @params[:start] ? (@params[:start].to_i / per_page) + 1 : 1 records = fetch_dt_records