ish_models 0.0.33.103 → 0.0.33.104

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: 6265d6ad8a5d5e85aad412b57b2f7751ff8816ea14e1743ab34891532f6f4cf4
4
- data.tar.gz: '08a2fa3206ca39253963aaac1ded20924328e798a5beb0e6034a80cf1b47ee4a'
3
+ metadata.gz: c54bda7472ded08d0e07e851a7479ffe905be79a5e3b408d4c461cba9731a0b3
4
+ data.tar.gz: 2a29fc4105594f11a10ef13b62244f28bf231a4756a0cbf2ba1b562aac9bdc5c
5
5
  SHA512:
6
- metadata.gz: 92e56359fae99ccb144e90eee2e0c8d8bc19d7403528fe9f58ff90a2fe2ba4270861f33e95524597ef9e938de4c569dc8ab74feeccb1030013f81a33e733c297
7
- data.tar.gz: f3128b3ef46bdfd56b696220a0f95a1c88c2fd012afbf80f15d1a3f0a26a9afb22b737f3efd68bd7bab8957df8c9650d3256b1bbd8fc8b2e7a860e8a6cb0898d
6
+ metadata.gz: 3873702c519b09a26929ebad21922dfa1d431663a7a56b7b7912edb889652ca97e0850a680943555312291dce405aa69b09f6855f808aea98c540424890eaa9e
7
+ data.tar.gz: c9ece62b2a99f31681cf9830cc1b2ac28caa8a88ae79ee59744134c852bfbdff76ee1d6cc65e25d0539ed37dc8c04e94248f663f5cf32783d103c9f685de96b8
data/lib/gallery.rb CHANGED
@@ -4,8 +4,15 @@ class Gallery
4
4
  include ::Mongoid::Document
5
5
  include ::Mongoid::Timestamps
6
6
 
7
- field :is_public, :type => Boolean, :default => false
8
- field :is_trash, :type => Boolean, :default => false
7
+ field :is_public, type: Boolean, default: false
8
+ field :is_trash, type: Boolean, default: false
9
+
10
+ field :premium_tier, type: Integer, default: 0 # how many stars need to spend, to get access? 0 = free
11
+ def is_premium
12
+ premium_tier > 0
13
+ end
14
+ def premium?; is_premium; end
15
+ has_many :premium_purchases, class_name: '::Gameui::PremiumPurchase', as: :item
9
16
 
10
17
  default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) }
11
18
 
@@ -21,7 +28,7 @@ class Gallery
21
28
  # validates :site, :presence => true
22
29
 
23
30
  belongs_to :user_profile, :optional => true, :class_name => 'IshModels::UserProfile', :inverse_of => :galleries
24
- field :username, :type => String # denormalization, not used _vp_ 20171203
31
+ field :username, :type => String
25
32
  has_and_belongs_to_many :shared_profiles, :class_name => 'IshModels::UserProfile', :inverse_of => :shared_galleries
26
33
 
27
34
  field :name, :type => String
@@ -29,7 +36,7 @@ class Gallery
29
36
 
30
37
  field :galleryname, :type => String
31
38
  index({ :galleryname => -1 }, { :unique => true })
32
- embeds_many :gallery_names, :class_name => 'Ish::GalleryName'
39
+ embeds_many :gallery_names, :class_name => '::Ish::GalleryName'
33
40
 
34
41
  field :subhead, :type => String
35
42
  field :descr, :type => String, :as => :description
@@ -43,10 +50,9 @@ class Gallery
43
50
 
44
51
  has_many :newsitems
45
52
 
46
-
47
53
  set_callback(:create, :before) do |doc|
48
- if doc.user_profile && doc.user_profile.username
49
- doc.username = doc.user_profile.username
54
+ if doc.user_profile && doc.user_profile.name
55
+ doc.username = doc.user_profile.name
50
56
  end
51
57
  doc.galleryname ||= doc.id.to_s
52
58
 
@@ -101,5 +107,9 @@ class Gallery
101
107
  RENDER_TITLES = 'gallery_render_titles_const' # string b/c transmited over http
102
108
  RENDER_THUMBS = 'gallery_render_thumbs_const' # string b/c transmited over http
103
109
 
110
+ def self.find_by_slug slug
111
+ ::Gallery.where( galleryname: slug ).first
112
+ end
113
+
104
114
  end
105
115
 
data/lib/gameui/map.rb ADDED
@@ -0,0 +1,30 @@
1
+
2
+ class ::Gameui::Map
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+
6
+ has_many :markers, :class_name => '::Gameui::Marker', inverse_of: :map
7
+
8
+ field :slug
9
+ validates :slug, uniqueness: true, presence: true
10
+ field :parent_slug
11
+
12
+ field :w, type: Integer
13
+ validates :w, presence: true
14
+
15
+ field :h, type: Integer
16
+ validates :h, presence: true
17
+
18
+ field :description
19
+
20
+ field :img_path
21
+
22
+ ORDERING_TYPE_ALPHABETIC = 'alphabetic'
23
+ ORDERING_TYPE_CUSTOM = 'custom'
24
+ ORDERING_TYPE_TIMESTAMP = 'timestamp'
25
+ ORDERING_TYPES = [ ORDERING_TYPE_ALPHABETIC, ORDERING_TYPE_CUSTOM, ORDERING_TYPE_TIMESTAMP ]
26
+ field :ordering_type, type: String, default: 'custom' # timestamp, alphabetic, custom
27
+ validates :ordering_type, presence: true
28
+
29
+
30
+ end
@@ -0,0 +1,43 @@
1
+
2
+ class ::Gameui::Marker
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+
6
+ belongs_to :map, :class_name => '::Gameui::Map'
7
+
8
+ field :slug
9
+ validates :slug, uniqueness: true, presence: true
10
+
11
+ field :w, type: Integer
12
+ validates :w, presence: true
13
+ field :h, type: Integer
14
+ validates :h, presence: true
15
+ field :x, type: Integer
16
+ validates :x, presence: true
17
+ field :y, type: Integer
18
+ validates :y, presence: true
19
+
20
+ field :img_path
21
+ validates :img_path, presence: true
22
+ field :title_img_path
23
+ validates :title_img_path, presence: true
24
+
25
+ field :description
26
+
27
+ field :is_active, type: Boolean, default: true
28
+ field :deleted_at, type: Time, default: nil
29
+
30
+ field :name, type: String
31
+ validates :name, presence: true
32
+
33
+ field :ordering, type: String, default: 'jjj'
34
+
35
+ ITEM_TYPE_LOCATION = 'gameui-location'
36
+ ITEM_TYPE_MAP = 'gameui-map'
37
+ ITEM_TYPES = [ ITEM_TYPE_LOCATION, ITEM_TYPE_MAP ]
38
+ field :item_type, type: String
39
+ validates :item_type, presence: true
40
+
41
+
42
+ end
43
+
@@ -0,0 +1,14 @@
1
+
2
+ class ::Gameui::PremiumPurchase
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+
6
+ belongs_to :user_profile, :class_name => '::IshModels::UserProfile'
7
+
8
+ field :purchased_class
9
+ field :purchased_id
10
+
11
+ belongs_to :item, polymorphic: true
12
+
13
+ end
14
+
data/lib/gameui.rb ADDED
@@ -0,0 +1,2 @@
1
+ class Gameui
2
+ end
data/lib/ish/campaign.rb CHANGED
@@ -1,8 +1,3 @@
1
-
2
- #
3
- # Campaign
4
- # _vp_ 20180128
5
- #
6
1
  class Ish::Campaign
7
2
  include Mongoid::Document
8
3
  include Mongoid::Timestamps
@@ -17,8 +12,6 @@ class Ish::Campaign
17
12
  field :subject
18
13
  field :body
19
14
 
20
-
21
-
22
15
  field :is_done, :type => Boolean, :default => false
23
16
  field :is_trash, :type => Boolean, :default => false
24
17
 
data/lib/ish/crawler.rb CHANGED
@@ -1,9 +1,3 @@
1
-
2
- def puts! a, b=''
3
- puts "+++ #{b}"
4
- puts a.inspect
5
- end
6
-
7
1
  module Ish
8
2
  class Crawler
9
3
 
@@ -13,12 +7,9 @@ module Ish
13
7
  website = r.css('cite')[0].text
14
8
  website = "https://#{website}" unless website[0..3] == 'http'
15
9
 
16
- puts! website, 'website'
17
-
18
10
  begin
19
11
  r = HTTParty.get( website, :verify => false )
20
12
  rescue OpenSSL::SSL::SSLError => e
21
- puts! e, 'e'
22
13
  return { :url => website }
23
14
  end
24
15
 
@@ -7,4 +7,3 @@ module Ish
7
7
  embedded_in :gallery
8
8
  end
9
9
  end
10
-
@@ -14,24 +14,12 @@ class IshModels::UserProfile
14
14
  field :fb_access_token
15
15
  field :fb_long_access_token
16
16
  field :fb_expires_in
17
-
18
- field :about, :type => String
19
- field :education, :type => String
20
- field :objectives, :type => String
21
- field :current_employment, :type => String
22
- field :past_employment, :type => String
23
-
24
- field :pdf_resume_path, :type => String
25
- field :doc_resume_path, :type => String
26
17
 
27
18
  field :lang, :type => String, :default => :en
28
19
 
29
20
  ROLES = [ :admin, :manager, :guy ]
30
21
  field :role_name, :type => Symbol
31
22
 
32
- TAGS = [ :social, :professional ]
33
- field :tag, :type => Symbol
34
-
35
23
  belongs_to :user
36
24
  belongs_to :current_city, :class_name => 'City', :inverse_of => :current_users, :optional => true
37
25
  belongs_to :guide_city, :class_name => 'City', :inverse_of => :guide, :optional => true
@@ -66,11 +54,12 @@ class IshModels::UserProfile
66
54
  [['', nil]] + out.map { |item| [ item.name, item.id ] }
67
55
  end
68
56
 
69
- # colombia tailors
57
+ #
58
+ # CoT - colombia tailors
59
+ #
70
60
  has_one :measurement, :class_name => '::CoTailors::ProfileMeasurement'
71
61
  has_many :addresses, :class_name => '::CoTailors::Address'
72
62
  has_many :orders, :class_name => '::CoTailors::Order'
73
-
74
63
  def current_order
75
64
  self.orders.where( :submitted_at => nil ).first || CoTailors::Order.create( :profile => self )
76
65
  end
@@ -79,5 +68,22 @@ class IshModels::UserProfile
79
68
  # GameUI
80
69
  #
81
70
  field :n_stars, type: Integer, default: 0
71
+ has_many :premium_purchases, :class_name => '::Gameui::PremiumPurchase'
72
+ def has_premium_purchase item
73
+ item.premium_purchases.where( user_profile: self ).exists?
74
+ end
82
75
 
83
76
  end
77
+
78
+ =begin
79
+ field :about, :type => String
80
+ field :education, :type => String
81
+ field :objectives, :type => String
82
+ field :current_employment, :type => String
83
+ field :past_employment, :type => String
84
+ field :pdf_resume_path, :type => String
85
+ field :doc_resume_path, :type => String
86
+
87
+ TAGS = [ :social, :professional ]
88
+ field :tag, :type => Symbol
89
+ =end
data/lib/ish_models.rb CHANGED
@@ -26,6 +26,11 @@ require 'co_tailors/order.rb'
26
26
  # require 'co_tailors/order_item.rb' # this is required from within order.rb
27
27
  require 'co_tailors/address.rb'
28
28
 
29
+ require 'gameui'
30
+ require 'gameui/map.rb'
31
+ require 'gameui/marker.rb'
32
+ require 'gameui/premium_purchase.rb'
33
+
29
34
  require 'ish/crawler.rb'
30
35
  require 'ish/gallery_name.rb'
31
36
  require 'ish/payment.rb'
data/lib/report.rb CHANGED
@@ -114,7 +114,7 @@ class Report
114
114
 
115
115
  unless doc.city.blank?
116
116
  city = City.find doc.city.id
117
- if doc.profile
117
+ if defined?( doc.profile ) && doc.profile
118
118
  username = doc.profile.username || 'anon'
119
119
  else
120
120
  username = '<username>'
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.103
4
+ version: 0.0.33.104
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -115,6 +115,10 @@ files:
115
115
  - lib/feature.rb
116
116
  - lib/gallery.rb
117
117
  - lib/gallery2.rb
118
+ - lib/gameui.rb
119
+ - lib/gameui/map.rb
120
+ - lib/gameui/marker.rb
121
+ - lib/gameui/premium_purchase.rb
118
122
  - lib/ish/campaign.rb
119
123
  - lib/ish/crawler.rb
120
124
  - lib/ish/gallery_name.rb