Class: CoTailors::Order

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document, Mongoid::Timestamps
Defined in:
lib/co_tailors/order.rb

Constant Summary collapse

MEASUREMENT_PARAMS =
[ :neck_around, :chest_around, :waist_around, :sleeve_length, :shoulder_width, :shirt_length, :bicep_around ]

Instance Method Summary collapse

Instance Method Details

#grand_totalObject



15
16
17
18
19
20
21
22
23
# File 'lib/co_tailors/order.rb', line 15

def grand_total
  tax = 0.05
  shipping = 0 # 1200

  subtotal = items.all.map { |i| i.cost }.reduce( :+ )
  subtotal = subtotal * (tax + 1)
  subtotal += shipping
  return subtotal.to_i
end