Find all producers for which we can create variant overrides

This commit is contained in:
Rohan Mitchell
2015-02-04 10:13:35 +11:00
parent 4c586d1b7e
commit a7bb04b890
2 changed files with 18 additions and 0 deletions

View File

@@ -20,6 +20,11 @@ module OpenFoodNetwork
managed_and_related_enterprises_with :edit_profile
end
def variant_override_producers
producer_ids = variant_override_enterprises_per_hub.values.flatten.uniq
Enterprise.where(id: producer_ids)
end
# For every hub that an admin manages, show all the producers for which that hub may
# override variants
# {hub1_id => [producer1_id, producer2_id, ...], ...}