Remove order cycles feature toggle

This commit is contained in:
Rohan Mitchell
2016-08-03 12:11:52 +10:00
parent 1388c077ea
commit e966b474b4
5 changed files with 4 additions and 12 deletions

View File

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

View File

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

View File

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

View File

@@ -7,7 +7,7 @@ module OpenFoodNetwork
private
def self.features
{order_cycles: true}
{}
end
end
end

View File

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