Sha256: 80a44243002e3782810e81604b27eb97ef01befb2fb9bc28106b60e6a9bc1164

Contents?: true

Size: 618 Bytes

Versions: 22

Compression:

Stored size: 618 Bytes

Contents

require_relative 'order_item'

class CoTailors::Order
  include Mongoid::Document
  include Mongoid::Timestamps

  belongs_to :profile, :class_name => '::Ish::UserProfile'

  has_many :items, :class_name => '::CoTailors::OrderItem'

  field :submitted_at, :type => Time

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

  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

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
ish_models-0.0.33.142 lib/co_tailors/order.rb
ish_models-0.0.33.141 lib/co_tailors/order.rb