ish_models 0.0.33.63 → 0.0.33.64

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 142e5269406378eb2b1ed8797f301b0e5beb6f06
4
- data.tar.gz: 45478a08fccf100b9ed18a95ad44ca36a57d1b54
3
+ metadata.gz: 2f1d96797ec6ad7709537223d88645bdc4518d17
4
+ data.tar.gz: 64798fa03ed516e21802138b44cd1fcc8d855ed9
5
5
  SHA512:
6
- metadata.gz: eb90db55eee8a74df67ed66c300c66fe6492909004cc6cc13172037c7d78c3ad7ef4e48e369899d4a3b86a3cbb30ef0f4373b74228c739e618e599cf1a2f0809
7
- data.tar.gz: e26acacb033c368c0ad594e215cef8a72b786da47e91da1bf499e53f6436adca64bb1e340dd1852911409bfb8d25762307306c83f9ded18bd5e51e3e8105a936
6
+ metadata.gz: 95f0c33727628d17dfec77fab6270f0fd69e72769aad7f7500c3654b798a5b2146cb07893e75665113e1e099ec7f2e71fcb16c9e2ddde76ba3ffffbdcd364c4b
7
+ data.tar.gz: bfdc57e6bf7961883634d964c160d8be05e75b53aef2ee668e7502322d6c8c07b79178f8efc3e81f807a5c0d4d3adf705f9779bea9d0ce39aab87381711f280b
@@ -10,5 +10,17 @@ class CoTailors::Order
10
10
 
11
11
  field :submitted_at, :type => Time
12
12
 
13
+ MEASUREMENT_PARAMS = [ :neck_around, :chest_around, :waist_around, :sleeve_length, :shoulder_width, :shirt_length, :bicep_around ]
14
+
15
+ def grand_total
16
+ tax = 0.05
17
+ shipping = 0 # 1200
18
+
19
+ subtotal = items.all.map { |i| i.cost }.reduce( :+ )
20
+ subtotal = subtotal * (tax + 1)
21
+ subtotal += shipping
22
+ return subtotal.to_i
23
+ end
24
+
13
25
  end
14
26
 
@@ -5,15 +5,15 @@ class CoTailors::OrderItem
5
5
 
6
6
  belongs_to :order, :class_name => 'CoTailors::Order'
7
7
 
8
- KIND_SHIRT = :shirt
9
- KIND_PANTS = :pants
10
- KIND_SUIT = :suit
11
- KINDS = [ :shirt, :pants, :suit ]
12
- field :kind, :type => Symbol
8
+ KIND_SHIRT = 'const-kind-shirt'
9
+ KIND_PANTS = 'const-kind-pants'
10
+ KIND_SUIT = 'const-kind-suits'
11
+ KINDS = %w{ const-kind-shirt const-kind-pants const-kind-suits }
12
+ field :kind, :type => String
13
13
  validates :kind, :presence => true
14
14
 
15
15
  FABRICS = [ :white, :black, :light_blue, :dark_blue, :dark_green, :pink, :gray ]
16
- field :fabric, :type => Symbol
16
+ field :fabric, :type => String
17
17
  validates :fabric, :presence => true
18
18
 
19
19
  has_one :measurement, :class_name => 'CoTailors::ProfileMeasurement'
@@ -22,5 +22,8 @@ class CoTailors::OrderItem
22
22
  field :quantity, :type => Integer
23
23
  validates :quantity, :presence => true
24
24
 
25
+ field :cost, :type => Integer # pennies!
26
+ validates :cost, :presence => true
27
+
25
28
  end
26
29
 
@@ -3,5 +3,9 @@ class CoTailors::Merchandise
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
5
 
6
+ def self.cost
7
+ return 7500
8
+ end
9
+
6
10
  end
7
11
 
@@ -12,14 +12,14 @@ class CoTailors::ProfileMeasurement
12
12
  belongs_to :order_item, :class_name => 'CoTailors::OrderItem', :optional => true
13
13
 
14
14
  ## shirt
15
- field :neck_around, :type => Float
16
- field :chest_around, :type => Float
17
- field :waist_around, :type => Float
18
- field :sleeve_length, :type => Float
19
- field :shoulder_width, :type => Float
20
- field :shirt_length, :type => Float
21
- field :bicep_around, :type => Float
22
- field :wrist_around, :type => Float
15
+ field :neck_around, :type => Float, :default => 0
16
+ field :chest_around, :type => Float, :default => 0
17
+ field :waist_around, :type => Float, :default => 0
18
+ field :sleeve_length, :type => Float, :default => 0
19
+ field :shoulder_width, :type => Float, :default => 0
20
+ field :shirt_length, :type => Float, :default => 0
21
+ field :bicep_around, :type => Float, :default => 0
22
+ field :wrist_around, :type => Float, :default => 0 # Is this optional? I want less here
23
23
  ## pants
24
24
  # length
25
25
  # waist
@@ -3,5 +3,9 @@ class CoTailors::Shirt
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
5
 
6
+ def self.cost
7
+ return 3000
8
+ end
9
+
6
10
  end
7
11
 
@@ -3,5 +3,9 @@ class CoTailors::Suit
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
5
 
6
+ def self.cost
7
+ return 30000
8
+ end
9
+
6
10
  end
7
11
 
data/lib/ish/lead.rb CHANGED
@@ -25,15 +25,15 @@ class Ish::Lead
25
25
 
26
26
  field :description
27
27
 
28
- STATES = [ :considering, :applied ]
29
- field :state, :type => Symbol
28
+ STATES = %w( considering applied )
29
+ field :state, :type => String
30
30
 
31
31
  field :is_done, :type => Boolean, :default => false
32
32
  field :is_trash, :type => Boolean, :default => false
33
33
 
34
34
  field :applied_on, :type => Time
35
35
 
36
- field :tag # 'hired_com_ror', not enumerated for now _vp_ 20180103
36
+ field :tag, :type => String # 'hired_com_ror', not enumerated for now _vp_ 20180103
37
37
  field :location
38
38
 
39
39
  field :raw_phone, :type => String
@@ -66,7 +66,7 @@ class IshModels::UserProfile
66
66
  end
67
67
 
68
68
  # colombia tailors
69
- has_many :measurements, :class_name => '::CoTailors::ProfileMeasurement'
69
+ has_one :measurement, :class_name => '::CoTailors::ProfileMeasurement'
70
70
  has_many :addresses, :class_name => '::CoTailors::Address'
71
71
  has_many :orders, :class_name => '::CoTailors::Order'
72
72
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.33.63
4
+ version: 0.0.33.64
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox