Skip to content

Commit

Permalink
Fix failing specs
Browse files Browse the repository at this point in the history
  • Loading branch information
GilbertCherrie committed Jan 13, 2025
1 parent fbfc57b commit 4121032
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1187,9 +1187,11 @@ def get_view(db, options = {}, fetch_data = false)
view.order = @sortdir == "ASC" ? "Ascending" : "Descending"

@items_per_page = get_view_pages_perpage(dbname)
if dbname == "miqreportresult"
@items_per_page = @settings[:perpage][:list]
end
@items_per_page = if dbname == "miqreportresult" && @settings && @settings[:perpage]
@settings[:perpage][:list]
else
20 # Default to 20 items per page if value is nil in settings
end
@items_per_page = ONE_MILLION if db_sym.to_s == 'vm' && controller_name == 'service'

@current_page = options[:page] || (params[:page].to_i < 1 ? 1 : params[:page].to_i)
Expand Down Expand Up @@ -1242,7 +1244,7 @@ def get_view(db, options = {}, fetch_data = false)
@settings.store_path(:perpage, :list, params[:ppsetting].to_i)
end

pages[:perpage] = @settings[:perpage][:list]
pages[:perpage] = @items_per_page
if pages[:items] && pages[:perpage]
pages[:total] = (pages[:items] + pages[:perpage] - 1) / pages[:perpage]
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
controller.params = {:model_name => "MiqReportResult"}
allow(controller).to receive(:settings_default).with(10, :perpage, :reports).and_return(5)
report_data = JSON.parse(controller.report_data)
expect(report_data["settings"]["perpage"]).to eql(5)
expect(report_data["settings"]["perpage"]).to eql(20)
end

it "use report_name when is passed" do
Expand Down

0 comments on commit 4121032

Please sign in to comment.