Load exchange variants from correct attr

This commit is contained in:
Rohan Mitchell
2013-01-10 11:03:35 +11:00
parent 5129e31f21
commit d27ef76ead
3 changed files with 3 additions and 3 deletions

View File

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

View File

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

View File

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