ish_models 0.0.33.145 → 0.0.33.149

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
  SHA256:
3
- metadata.gz: 59d512837bf94f2172832f0c5ae57d157b5dd0d9af9657f384f0cfee91efc430
4
- data.tar.gz: 704019952ecc2c73b41b82de6ca8b43bb77a12220620a13b11070a65fe7d8f31
3
+ metadata.gz: af77cb84fd5fe123e232d66b36e090ed15f5a98c4ce97cfa49d8d1a0717f83d9
4
+ data.tar.gz: fd202da5dfb24c5850781b49a8965d4c266f02529917721a20864dea5491c4b9
5
5
  SHA512:
6
- metadata.gz: e48cacf28a8f441b30a9ef7f27f2c00184fa6891e1658cddb04d6614bbe23d1ea7f8c227581719f4f3b3b08eb6914ba41039b5c7d3c4a9bdfc406f9cc61515f3
7
- data.tar.gz: ff6b2778ef8d29d4e6184ac44100de00d64647874b3d02a5829eacb330aab2f574f185c8525bc8307c70ce16b94842ba475bf85940e9da8a2b3aea6a88268eaf
6
+ metadata.gz: '098f8e1013de0d59e3ebec5478b98147e5bdc166fc9ad03989c4af64cc4680f26fbda13f408f3dc919ce936654f875a469d91194ae94fef8e9b670feca1d7ec0'
7
+ data.tar.gz: b58f6e2a99d512afd89dcf0626cb69b0746a02c087fd7a7f179d7386974b9ee4a0d61be58c985c1df92c1ba0719e4ee1bc5b8beedf4e44d2f8e135199920c070
data/lib/gameui/map.rb CHANGED
@@ -24,8 +24,6 @@ class ::Gameui::Map
24
24
  # shareable, nonpublic
25
25
  field :is_public, type: Boolean, default: true
26
26
  has_and_belongs_to_many :shared_profiles, :class_name => 'Ish::UserProfile', :inverse_of => :shared_locations
27
- default_scope ->{ where({ is_public: true, deleted_at: nil }).order_by({ slug: :desc }) }
28
- ## @TODO: index default scope, maybe instead of HABTM, use :thru for shared profiles. Make is poly anyway?
29
27
 
30
28
 
31
29
  field :map_slug
data/lib/gameui/marker.rb CHANGED
@@ -60,7 +60,8 @@ class ::Gameui::Marker
60
60
 
61
61
  ITEM_TYPE_LOCATION = 'gameui-location'
62
62
  ITEM_TYPE_MAP = 'gameui-map'
63
- ITEM_TYPES = [ ITEM_TYPE_LOCATION, ITEM_TYPE_MAP ]
63
+ ITEM_TYPE_OBJ = 'gameui-obj'
64
+ ITEM_TYPES = [ ITEM_TYPE_LOCATION, ITEM_TYPE_MAP, ITEM_TYPE_OBJ ]
64
65
  field :item_type, type: String
65
66
  validates :item_type, presence: true
66
67
 
@@ -6,6 +6,7 @@ class Ish::UserProfile
6
6
  validates_presence_of :name
7
7
 
8
8
  field :username
9
+ field :scratchpad
9
10
 
10
11
  field :email
11
12
  # validates_format_of :email, :with => ::Devise::email_regexp
@@ -80,4 +81,30 @@ class Ish::UserProfile
80
81
  ::Gameui::PremiumPurchase.where( user_profile_id: self.id )
81
82
  end
82
83
 
84
+ # used in rake tasks
85
+ def self.generate delta
86
+ email = delta[:email]
87
+ password = delta[:password]
88
+ role_name = delta[:role_name]
89
+
90
+ profile = Ish::UserProfile.where( email: email ).first
91
+ if profile
92
+ puts! profile, "UserProfile#generate, already exists"
93
+ return
94
+ end
95
+
96
+ user = User.where( email: email ).first
97
+ if !user
98
+ user = User.new({ email: email, password: password })
99
+ end
100
+ profile = Ish::UserProfile.new({ email: email, name: email, role_name: role_name, user: user })
101
+ profile.save
102
+
103
+ if profile.persisted?
104
+ ;
105
+ else
106
+ puts! profile.errors.full_messages, "Cannot save profile"
107
+ end
108
+ end
109
+
83
110
  end
data/lib/video.rb CHANGED
@@ -2,16 +2,25 @@ class Video
2
2
  include Mongoid::Document
3
3
  include Mongoid::Timestamps
4
4
  include Mongoid::Paperclip
5
+ include Mongoid::Paranoia
5
6
 
6
7
  PER_PAGE = 6
7
8
 
8
9
  field :name, :type => String
9
10
  field :descr, :type => String, :as => :description
10
11
 
11
- default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) }
12
+ # default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) }
12
13
 
13
14
  field :is_trash, :type => Boolean, :default => false
14
- field :is_public, :type => Boolean, :default => true
15
+ def is_trash
16
+ if deleted_at
17
+ true
18
+ else
19
+ self[:is_trash]
20
+ end
21
+ end
22
+
23
+ field :is_public, :type => Boolean, :default => false
15
24
  field :is_feature, :type => Boolean, :default => false
16
25
 
17
26
  field :x, :type => Float
@@ -2,6 +2,7 @@
2
2
  class Warbler::StockWatch
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
+ store_in collection: 'ish_stock_watches'
5
6
 
6
7
  field :ticker
7
8
 
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.145
4
+ version: 0.0.33.149
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 7.0.5
27
+ - !ruby/object:Gem::Dependency
28
+ name: mongoid_paranoia
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: mongoid-autoinc
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -152,9 +166,9 @@ files:
152
166
  - lib/warbler/stock_option.rb
153
167
  - lib/warbler/stock_watch.rb
154
168
  - lib/warbler/yahoo_stockwatcher.rb
155
- homepage: http://wasya.co
169
+ homepage: https://wasya.co
156
170
  licenses:
157
- - MIT
171
+ - Proprietary
158
172
  metadata: {}
159
173
  post_install_message:
160
174
  rdoc_options: []
@@ -171,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
185
  - !ruby/object:Gem::Version
172
186
  version: '0'
173
187
  requirements: []
174
- rubygems_version: 3.0.3.1
188
+ rubygems_version: 3.1.6
175
189
  signing_key:
176
190
  specification_version: 4
177
191
  summary: models of ish