mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Load exchange variants from correct attr
This commit is contained in:
@@ -61,7 +61,7 @@ angular.module('order_cycle', ['ngResource']).
|
||||
},
|
||||
|
||||
addSupplier: function(new_supplier_id) {
|
||||
this.order_cycle.incoming_exchanges.push({enterprise_id: new_supplier_id, active: true});
|
||||
this.order_cycle.incoming_exchanges.push({enterprise_id: new_supplier_id, active: true, variants: {}});
|
||||
},
|
||||
|
||||
load: function(order_cycle_id) {
|
||||
|
||||
@@ -51,7 +51,7 @@ module OpenFoodWeb
|
||||
|
||||
|
||||
def exchange_variant_ids(exchange)
|
||||
exchange[:exchange_variants].select { |k, v| v }.keys.map { |k| k.to_i }
|
||||
exchange[:variants].select { |k, v| v }.keys.map { |k| k.to_i }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -119,7 +119,7 @@ module OpenFoodWeb
|
||||
it "converts exchange variant ids hash to an array of ids" do
|
||||
applicator = OrderCycleFormApplicator.new(nil)
|
||||
|
||||
applicator.send(:exchange_variant_ids, {:enterprise_id => 123, :exchange_variants => {'1' => true, '2' => false, '3' => true}}).should == [1, 3]
|
||||
applicator.send(:exchange_variant_ids, {:enterprise_id => 123, :variants => {'1' => true, '2' => false, '3' => true}}).should == [1, 3]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user