Skip to content

Commit

Permalink
Refs #38072 - select default pagination properly
Browse files Browse the repository at this point in the history
  • Loading branch information
ianballou committed Dec 18, 2024
1 parent 723f2e8 commit 8195888
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class Api::V2::HostBootcImagesController < Api::V2::ApiController
def bootc_images
bootc_image_map = bootc_host_image_map(params[:search])

page = params[:page].to_i || 1
per_page = params[:per_page].to_i || Setting[:entries_per_page]
page = params[:page].present? ? params[:page].to_i : 1
per_page = params[:per_page].present? ? params[:per_page].to_i : Setting[:entries_per_page]
paged_images = bootc_image_map.to_a.paginate(page: page, per_page: per_page)
results = paged_images.collect { |image| { image_name: image[0], digests: image[1] } }
render json: { total: bootc_image_map.size, page: page, per_page: per_page, subtotal: bootc_image_map.size, results: results}
Expand Down

0 comments on commit 8195888

Please sign in to comment.