ish_models 0.0.33.163 → 0.0.33.164

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68d413825a0a694b0bdfd1a6fee4a85812bb2f3d34e0f431d2b0a30c27b29304
4
- data.tar.gz: 3a5a7db6ce515ba7e9711839ab4c10b8f74387abd0e6d38c7bf0510d5e86094b
3
+ metadata.gz: a783500814f32b8c34ef3feade0aef48169ea390eb033422518593edef4cf67b
4
+ data.tar.gz: ae18235c6b0862be5e0d09b53c86002d1bf76824d17391b2a4507749f358d911
5
5
  SHA512:
6
- metadata.gz: c6b20eb004d674c488b459c23c12ca284bacefb558e1dfcdf03ce2e9b9548fb92ee7ba0c7452dbefb785b05e908a00f4ebdbda6548db7ae9a59df327944032b1
7
- data.tar.gz: 2de807a995e6523d7ff0251f26a24daa127b3b13c1a00279baa69f72b78f708ff0e4cf5317255b19b8cc1f4b98fc629b4aede0321342b2baa6ab4b6d454f0596
6
+ metadata.gz: 4522756a1cedf0b0a570e13ad1a35dda926930aadbb7dbe5112de03923b3c5f133ee1e0c569639bf01fccb4be7926a82d406523c8ef1fe2c18705c9bc93e70be
7
+ data.tar.gz: 45b1305bdb9395f37325d78183d746ff7c9c2f6a9bb01ca533dc56b11ac176816cf9ad01b612d58514ff43e7ea0395b126b7fe682ae4a81fcd4091420493d591
@@ -1,5 +1,5 @@
1
1
 
2
- class CoTailors::Address
2
+ class Address
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
5
 
data/lib/city.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  class City
2
2
  include ::Mongoid::Document
3
3
  include ::Mongoid::Timestamps
4
- include AuxModel
5
4
 
6
5
  field :name, :type => String
7
6
  field :description, :type => String, :default => 'The description of this city'
data/lib/gameui/map.rb CHANGED
@@ -87,7 +87,7 @@ class ::Gameui::Map
87
87
 
88
88
  def self.list conditions = { is_trash: false }
89
89
  out = self.order_by( created_at: :desc )
90
- [[nil, nil]] + out.map { |item| [ item.name, item.id ] }
90
+ [[nil, nil]] + out.map { |item| [ item.name, item.id.to_s ] }
91
91
  end
92
92
 
93
93
  def breadcrumbs
data/lib/gameui/marker.rb CHANGED
@@ -4,13 +4,12 @@ class ::Gameui::Marker
4
4
  include Mongoid::Timestamps
5
5
  include Ish::Utils
6
6
 
7
- field :slug
8
- ## @TODO: probably remove this, no reason not to have two markers to the same slug (destination)
9
- validates_uniqueness_of :slug, scope: :map_id
10
- validates_presence_of :slug
11
-
12
7
  field :name, type: String
13
- validates :name, presence: true
8
+ validates_uniqueness_of :name, scope: :map_id
9
+ validates_presence_of :name
10
+ def slug
11
+ id.to_s
12
+ end
14
13
 
15
14
  field :ordering, type: String, default: 'jjj'
16
15
 
@@ -31,8 +30,8 @@ class ::Gameui::Marker
31
30
  field :deleted_at, type: Time, default: nil # @TODO: replace with paranoia
32
31
 
33
32
  ## @TODO: abstract this into a module
34
- field :x, :type => Float
35
- field :y, :type => Float
33
+ field :x, :type => Float, default: 0
34
+ field :y, :type => Float, default: 0
36
35
 
37
36
  field :is_public, type: Boolean, default: true
38
37
  def self.public
@@ -54,19 +53,7 @@ class ::Gameui::Marker
54
53
 
55
54
  belongs_to :map, class_name: '::Gameui::Map', inverse_of: :markers
56
55
 
57
- belongs_to :destination, class_name: '::Gameui::Map', inverse_of: :from_markers
58
- before_validation :set_destination
59
- def set_destination
60
- d = Map.where({ slug: slug }).first
61
-
62
- puts! self, '#set_destination'
63
-
64
- if !d
65
- self.errors.add( "Cannot save marker, destination |#{slug}| not found." )
66
- return
67
- end
68
- self.destination_id = d.id
69
- end
56
+ belongs_to :destination, class_name: '::Gameui::Map', inverse_of: :from_markers
70
57
 
71
58
  belongs_to :creator_profile, class_name: 'Ish::UserProfile', inverse_of: :my_markers
72
59
 
@@ -98,11 +85,8 @@ class ::Gameui::Marker
98
85
  end
99
86
  end
100
87
 
101
- field :centerOffsetX, type: Integer, default: 0
102
- # validates :centerXOffset, presence: true
103
-
104
- field :centerOffsetY, type: Integer, default: 0
105
- # validates :centerYOffset, presence: true
88
+ field :centerOffsetX, type: Float, default: 0
89
+ field :centerOffsetY, type: Float, default: 0
106
90
 
107
91
 
108
92
 
data/lib/ish/lead.rb CHANGED
@@ -7,7 +7,7 @@ class Ish::Lead
7
7
  include Mongoid::Document
8
8
  include Mongoid::Timestamps
9
9
 
10
- store_in :collection => 'ish_lead'
10
+ store_in :collection => 'ish_leads'
11
11
 
12
12
  belongs_to :profile, :class_name => '::Ish::UserProfile'
13
13
 
@@ -49,3 +49,6 @@ class Ish::Lead
49
49
  field :extra, :type => Array, :default => []
50
50
 
51
51
  end
52
+
53
+ Lead = Ish::Lead
54
+
data/lib/ish_models.rb CHANGED
@@ -45,7 +45,6 @@ require 'ish/premium_item'
45
45
  require 'ish/utils'
46
46
  require 'ish/user_profile'
47
47
 
48
- require 'aux_model'
49
48
  require 'city'
50
49
  require 'cities_user'
51
50
  require 'country'
data/lib/site.rb CHANGED
@@ -2,7 +2,6 @@ class Site
2
2
 
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
- include AuxModel
6
5
 
7
6
  field :domain, :type => String
8
7
  validates_presence_of :domain
data/lib/video.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'mongoid/paranoia'
2
+
1
3
  class Video
2
4
  include Mongoid::Document
3
5
  include Mongoid::Timestamps
@@ -10,8 +12,6 @@ class Video
10
12
  field :name, :type => String
11
13
  field :descr, :type => String, :as => :description
12
14
 
13
- # default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) }
14
-
15
15
  field :is_trash, :type => Boolean, :default => false
16
16
  def is_trash
17
17
  if deleted_at
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.163
4
+ version: 0.0.33.164
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -114,15 +114,9 @@ executables: []
114
114
  extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
- - lib/aux_model.rb
117
+ - lib/address.rb
118
118
  - lib/cities_user.rb
119
119
  - lib/city.rb
120
- - lib/co_tailors/README.txt
121
- - lib/co_tailors/address.rb
122
- - lib/co_tailors/order.rb
123
- - lib/co_tailors/order_item.rb
124
- - lib/co_tailors/product.rb
125
- - lib/co_tailors/profile_measurement.rb
126
120
  - lib/country.rb
127
121
  - lib/event.rb
128
122
  - lib/feature.rb
data/lib/aux_model.rb DELETED
@@ -1,22 +0,0 @@
1
-
2
- module AuxModel
3
-
4
- def add_newsitem item
5
- n = Newsitem.new
6
- case item.class.name
7
- when 'Video'
8
- n.video_id = item.id
9
- when 'Photo'
10
- raise 'Not Implemented'
11
- when 'Report'
12
- raise 'Not Implemented'
13
- when 'Gallery'
14
- raise 'Not Implmented'
15
- else
16
- raise 'Not Implemented'
17
- end
18
- self.newsitems << n
19
- self.save
20
- end
21
-
22
- end
@@ -1,2 +0,0 @@
1
-
2
- namespace co_tailors is trash. It'd take me too much eddors, and I'd rather use SpreeCommerce.
@@ -1,26 +0,0 @@
1
- require_relative 'order_item'
2
-
3
- class CoTailors::Order
4
- include Mongoid::Document
5
- include Mongoid::Timestamps
6
-
7
- belongs_to :profile, :class_name => '::Ish::UserProfile'
8
-
9
- has_many :items, :class_name => '::CoTailors::OrderItem'
10
-
11
- field :submitted_at, :type => Time
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
-
25
- end
26
-
@@ -1,29 +0,0 @@
1
-
2
- class CoTailors::OrderItem
3
- include Mongoid::Document
4
- include Mongoid::Timestamps
5
-
6
- belongs_to :order, :class_name => 'CoTailors::Order'
7
-
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
- validates :kind, :presence => true
14
-
15
- FABRICS = [ :white, :black, :light_blue, :dark_blue, :dark_green, :pink, :gray ]
16
- field :fabric, :type => String
17
- validates :fabric, :presence => true
18
-
19
- has_one :measurement, :class_name => 'CoTailors::ProfileMeasurement'
20
- validates :measurement, :presence => true
21
-
22
- field :quantity, :type => Integer
23
- validates :quantity, :presence => true
24
-
25
- field :cost, :type => Integer # pennies!
26
- validates :cost, :presence => true
27
-
28
- end
29
-
@@ -1,16 +0,0 @@
1
-
2
- class CoTailors::Product
3
- include Mongoid::Document
4
- include Mongoid::Timestamps
5
-
6
- field :cost, :type => Integer
7
- field :title, :type => String
8
- field :description, :type => String
9
-
10
- KINDS = %w( shirt pants suit )
11
- field :kind, :type => String
12
- index({ :kind => -1 })
13
- validates_uniqueness_of :kind
14
-
15
- end
16
-
@@ -1,32 +0,0 @@
1
-
2
- class CoTailors::ProfileMeasurement
3
- include Mongoid::Document
4
- include Mongoid::Timestamps
5
-
6
- UNITS = [ :inches, :centimeters ]
7
- UNITS_INCHES = :inches
8
- UNITS_CENTIMETERS = :centimeters
9
- field :units, :type => Symbol
10
-
11
- belongs_to :profile, :class_name => 'Ish::UserProfile', :optional => true
12
- belongs_to :order_item, :class_name => 'CoTailors::OrderItem', :optional => true
13
-
14
- ## shirt
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
- ## pants
24
- # length
25
- # waist
26
- # hips
27
- ## suit
28
-
29
- field :nickname
30
-
31
- end
32
-