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.163 lib/co_tailors/order.rb
ish_models-0.0.33.162 lib/co_tailors/order.rb
ish_models-0.0.33.161 lib/co_tailors/order.rb
ish_models-0.0.33.160 lib/co_tailors/order.rb
ish_models-0.0.33.159 lib/co_tailors/order.rb
ish_models-0.0.33.158 lib/co_tailors/order.rb
ish_models-0.0.33.157 lib/co_tailors/order.rb
ish_models-0.0.33.156 lib/co_tailors/order.rb
ish_models-0.0.33.154 lib/co_tailors/order.rb
ish_models-0.0.33.153 lib/co_tailors/order.rb
ish_models-0.0.33.152 lib/co_tailors/order.rb
ish_models-0.0.33.151 lib/co_tailors/order.rb
ish_models-0.0.33.150 lib/co_tailors/order.rb
ish_models-0.0.33.149 lib/co_tailors/order.rb
ish_models-0.0.33.148 lib/co_tailors/order.rb
ish_models-0.0.33.147 lib/co_tailors/order.rb
ish_models-0.0.33.146 lib/co_tailors/order.rb
ish_models-0.0.33.145 lib/co_tailors/order.rb
ish_models-0.0.33.144 lib/co_tailors/order.rb
ish_models-0.0.33.143 lib/co_tailors/order.rb