From e966b474b4ab34810a5e20c288a9e701c02f653e Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Wed, 3 Aug 2016 12:11:52 +1000 Subject: [PATCH] Remove order cycles feature toggle --- app/helpers/order_cycles_helper.rb | 4 ---- app/models/spree/order_decorator.rb | 6 +----- app/views/spree/products/_add_to_cart.html.haml | 2 +- lib/open_food_network/feature_toggle.rb | 2 +- spec/models/spree/order_spec.rb | 2 +- 5 files changed, 4 insertions(+), 12 deletions(-) diff --git a/app/helpers/order_cycles_helper.rb b/app/helpers/order_cycles_helper.rb index 18222ee1f0..031fdf4736 100644 --- a/app/helpers/order_cycles_helper.rb +++ b/app/helpers/order_cycles_helper.rb @@ -67,10 +67,6 @@ module OrderCyclesHelper @order_cycles_simple_form ||= @order_cycle.coordinator.sells == 'own' end - def order_cycles_enabled? - OpenFoodNetwork::FeatureToggle.enabled? :order_cycles - end - def pickup_time(order_cycle = current_order_cycle) order_cycle.exchanges.to_enterprises(current_distributor).outgoing.first.pickup_time end diff --git a/app/models/spree/order_decorator.rb b/app/models/spree/order_decorator.rb index a4995274b3..fccbc639b2 100644 --- a/app/models/spree/order_decorator.rb +++ b/app/models/spree/order_decorator.rb @@ -74,11 +74,7 @@ Spree::Order.class_eval do # -- Methods def products_available_from_new_distribution # Check that the line_items in the current order are available from a newly selected distribution - if OpenFoodNetwork::FeatureToggle.enabled? :order_cycles - errors.add(:base, "Distributor or order cycle cannot supply the products in your cart") unless DistributionChangeValidator.new(self).can_change_to_distribution?(distributor, order_cycle) - else - errors.add(:distributor_id, "cannot supply the products in your cart") unless DistributionChangeValidator.new(self).can_change_to_distributor?(distributor) - end + errors.add(:base, "Distributor or order cycle cannot supply the products in your cart") unless DistributionChangeValidator.new(self).can_change_to_distribution?(distributor, order_cycle) end def empty_with_clear_shipping_and_payments! diff --git a/app/views/spree/products/_add_to_cart.html.haml b/app/views/spree/products/_add_to_cart.html.haml index 621b999ddc..dd406ff50b 100644 --- a/app/views/spree/products/_add_to_cart.html.haml +++ b/app/views/spree/products/_add_to_cart.html.haml @@ -7,7 +7,7 @@ - elsif !distributor_available_for?(order, @product) = render 'add_to_cart_distributor_unavailable' - - elsif !order_cycle_available_for?(order, @product) and order_cycles_enabled? + - elsif !order_cycle_available_for?(order, @product) = render 'add_to_cart_order_cycle_unavailable' - else diff --git a/lib/open_food_network/feature_toggle.rb b/lib/open_food_network/feature_toggle.rb index 10d49a3d1a..0721e01c44 100644 --- a/lib/open_food_network/feature_toggle.rb +++ b/lib/open_food_network/feature_toggle.rb @@ -7,7 +7,7 @@ module OpenFoodNetwork private def self.features - {order_cycles: true} + {} end end end diff --git a/spec/models/spree/order_spec.rb b/spec/models/spree/order_spec.rb index 114c7d5fac..2140163f98 100644 --- a/spec/models/spree/order_spec.rb +++ b/spec/models/spree/order_spec.rb @@ -437,7 +437,7 @@ describe Spree::Order do subject.distributor = test_enterprise subject.should_not be_valid - subject.errors.messages.should == {:distributor_id => ["cannot supply the products in your cart"]} + subject.errors.messages.should == {:base => ["Distributor or order cycle cannot supply the products in your cart"]} end end