Merge branch 'caching' into new_cart

Conflicts:
	app/serializers/api/variant_serializer.rb
This commit is contained in:
Will Marshall
2014-07-18 11:23:25 +10:00
7 changed files with 70 additions and 5 deletions

View File

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