Add comments linking areas concerned with separating products by distributor and order cycle

This commit is contained in:
Rohan Mitchell
2013-03-15 17:02:54 +11:00
parent 81b65efb29
commit 1d7cf4436a
3 changed files with 13 additions and 1 deletions

View File

@@ -6,6 +6,10 @@ module Spree
root_taxon.children.map do |taxon|
css_class = (current_taxon && current_taxon.self_and_ancestors.include?(taxon)) ? 'current' : nil
# The concern of separating products by distributor and order cycle is dealt with in
# a few other places: OpenFoodWeb::Searcher (for searching over products) and in
# OpenFoodWeb::SplitProductsByDistributor (for splitting the main product display).
products = Product.in_taxon(taxon)
products = products.in_distributor(current_distributor) if current_distributor
products = products.in_order_cycle(current_order_cycle) if current_order_cycle

View File

@@ -14,6 +14,10 @@ module OpenFoodWeb
def get_base_scope
base_scope = super
# The concern of separating products by distributor and order cycle is dealt with in
# a few other places: OpenFoodWeb::SplitProductsByDistributor (for splitting the main
# product display) and Spree::BaseHelper decorator (for taxon counts).
base_scope = base_scope.in_supplier_or_distributor(enterprise_id) if enterprise_id
base_scope = base_scope.in_supplier(supplier_id) if supplier_id
base_scope = base_scope.in_distributor(distributor_id) if distributor_id

View File

@@ -1,6 +1,10 @@
module OpenFoodWeb
module SplitProductsByDistributor
# The concern of separating products by distributor and order cycle is dealt with in a few
# other places: OpenFoodWeb::Searcher (for searching over products) and in
# Spree::BaseHelper decorator (for taxon counts).
module SplitProductsByDistributor
# If a distributor is provided, split the list of products into local (at that
# distributor) and remote (at another distributor). If a distributor is not
# provided, perform no split.