fixed test failure

This commit is contained in:
piyush828-design
2025-04-16 17:45:39 +05:30
parent da5cef26db
commit 3202d0ea81
10 changed files with 10 additions and 10 deletions

View File

@@ -138,7 +138,7 @@ module Admin
def fetch_products
product_query = OpenFoodNetwork::Permissions.new(spree_current_user)
.editable_products.merge(product_scope).ransack(ransack_query).result
@pagy, @products = pagy(product_query.order(:name), items: @per_page, page: @page,
@pagy, @products = pagy(product_query.order(:name), limit: @per_page, page: @page,
size: [1, 2, 2, 1])
end

View File

@@ -77,7 +77,7 @@ module Api
if pagination_required?
@pagy, results = pagy(results,
items: params[:per_page] || DEFAULT_PER_PAGE)
limit: params[:per_page] || DEFAULT_PER_PAGE)
end
serialized_products = ActiveModel::ArraySerializer.new(

View File

@@ -12,7 +12,7 @@ module Api
if pagination_required?
@pagy, orders = pagy(orders,
items: params[:per_page] || default_per_page)
limit: params[:per_page] || default_per_page)
end
render json: {

View File

@@ -78,7 +78,7 @@ module Api
end
def render_paged_products(products, product_serializer = ::Api::Admin::ProductSerializer)
@pagy, products = pagy(products, items: params[:per_page] || DEFAULT_PER_PAGE)
@pagy, products = pagy(products, limit: params[:per_page] || DEFAULT_PER_PAGE)
serialized_products = ActiveModel::ArraySerializer.new(
products,

View File

@@ -17,7 +17,7 @@ module Spree
def index
orders = SearchOrders.new(search_params, spree_current_user).orders
@pagy, @orders = pagy(orders, items: params[:per_page] || 15)
@pagy, @orders = pagy(orders, limit: params[:per_page] || 15)
update_search_results if searching?
end

View File

@@ -60,7 +60,7 @@ module Spree
limit(params[:limit] || 100)
else
@search = Spree::User.ransack(params[:q])
@pagy, @collection = pagy(@search.result, items: Spree::Config[:admin_products_per_page])
@pagy, @collection = pagy(@search.result, limit: Spree::Config[:admin_products_per_page])
@collection
end
end

View File

@@ -15,7 +15,7 @@ module Spree
params[:q] ||= {}
params[:q][:s] ||= "name asc"
@search = super.ransack(params[:q])
@pagy, @zones = pagy(@search.result, items: Spree::Config[:orders_per_page])
@pagy, @zones = pagy(@search.result, limit: Spree::Config[:orders_per_page])
@zones
end

View File

@@ -39,7 +39,6 @@ class ProductsRenderer
else
distributed_products.products_relation
end
results = filter(results)
# Scope results with variant_overrides
paginate(results).each { |product| product_scoper.scope(product) }
@@ -100,7 +99,7 @@ class ProductsRenderer
_pagy, paginated_results = pagy_array(
results,
page: args[:page] || 1,
items: args[:per_page] || DEFAULT_PER_PAGE
limit: args[:per_page] || DEFAULT_PER_PAGE
)
paginated_results

View File

@@ -10,7 +10,7 @@
%form.with-dropdown
= t(".pagination.per_page.show")
= select_tag :per_page,
options_for_select([15, 25, 50, 100].collect{|i| [t('.pagination.per_page.per_page', num: i), i]}, pagy&.items),
options_for_select([15, 25, 50, 100].collect{|i| [t('.pagination.per_page.per_page', num: i), i]}, pagy&.limit),
class: "no-input per-page",
data: { controller: "tom-select search", action: "change->search#changePerPage", "tom-select-options-value": '{ "plugins": [] }'}

View File

@@ -4,6 +4,7 @@ require 'pagy/extras/arel'
require 'pagy/extras/array'
require 'pagy/extras/limit'
require 'pagy/extras/overflow'
require 'pagy/extras/size'
# Pagy Variables
# See https://ddnexus.github.io/pagy/api/pagy#variables