mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
Merge branch 'caching' into new_cart
Conflicts: app/serializers/api/variant_serializer.rb
This commit is contained in:
@@ -8,10 +8,16 @@ class ShopController < BaseController
|
||||
end
|
||||
|
||||
def products
|
||||
unless @products = current_order_cycle.andand
|
||||
# Can we make this query less slow?
|
||||
#
|
||||
if @products = current_order_cycle.andand
|
||||
.valid_products_distributed_by(current_distributor).andand
|
||||
.select { |p| !p.deleted? && p.has_stock_for_distribution?(current_order_cycle, current_distributor) }.andand
|
||||
.sort_by {|p| p.name }
|
||||
render status: 200,
|
||||
json: ActiveModel::ArraySerializer.new(@products, each_serializer: Api::ProductSerializer,
|
||||
current_order_cycle: current_order_cycle, current_distributor: current_distributor).to_json
|
||||
else
|
||||
render json: "", status: 404
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user