Add default page size when it's not in request params when fetching projects

This commit is contained in:
Matej Zrimšek 2018-10-04 21:48:15 +02:00
parent 2794f75215
commit c8d170f9ec

View file

@ -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