Merge pull request #2539 from luisramos0/delete_dead_cart

removed Cart route, controller, model and specs: dead code
This commit is contained in:
Maikel
2018-08-22 17:35:58 +10:00
committed by GitHub
15 changed files with 8 additions and 340 deletions

View File

@@ -1,28 +0,0 @@
class Cart < ActiveRecord::Base
has_many :orders, :class_name => 'Spree::Order'
belongs_to :user, :class_name => Spree.user_class
def add_variant variant_id, quantity, distributor, order_cycle, currency
order = create_or_find_order_for_distributor distributor, order_cycle, currency
@populator = Spree::OrderPopulator.new(order, currency)
@populator.populate({ :variants => { variant_id => quantity } })
end
def create_or_find_order_for_distributor distributor, order_cycle, currency
order_for_distributor = orders.find { |order| order.distributor == distributor && order.order_cycle == order_cycle }
unless order_for_distributor
order_for_distributor = Spree::Order.create(:currency => currency, :distributor => distributor)
order_for_distributor.distributor = distributor
order_for_distributor.order_cycle = order_cycle
order_for_distributor.save!
orders << order_for_distributor
end
order_for_distributor
end
def populate_errors
@populator.errors
end
end

View File

@@ -10,7 +10,6 @@ end
Spree::Order.class_eval do
belongs_to :order_cycle
belongs_to :distributor, class_name: 'Enterprise'
belongs_to :cart
belongs_to :customer
has_one :proxy_order
has_one :subscription, through: :proxy_order

View File

@@ -9,7 +9,6 @@ Spree.user_class.class_eval do
has_many :owned_groups, class_name: 'EnterpriseGroup', foreign_key: :owner_id, inverse_of: :owner
has_many :account_invoices
has_many :billable_periods, foreign_key: :owner_id, inverse_of: :owner
has_one :cart
has_many :customers
has_many :credit_cards