ish_models 0.0.33.129 → 0.0.33.130

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: 9ddb473d3919f9fbd1f3776bac2dbee971c7191428d5bc18fb31c3a3412a73eb
4
- data.tar.gz: 52aea5b794ff6a8f9dae484a7b364aa72df71bcbfb012ab43492d743d4a4badd
3
+ metadata.gz: 8c34bbd347229cb392198bb194abc4c7d2902cb478aaac34b43b89c2014ab2d3
4
+ data.tar.gz: 83c55591061a4ed85905e50f3aaf6fdcae9eed57d25fb4f0f36dd1cbe4d16bbe
5
5
  SHA512:
6
- metadata.gz: cd05ef3be3aa54a2bf92e33aa9404dc654ecb25c288ed728836184d68a53adee5ecc9dc279a3c35b771fa0178f2ae10a9f89006a18c7dd9a50154c332fa34034
7
- data.tar.gz: 9cb96337052e622e4ea2545724fe32241d0949849dd3e09ad79186f3ba3c46bb1df328ec4c8acb5d6a5fc00ed4ec2f7d3390783edcba5a5e0792f0d1506db707
6
+ metadata.gz: a2e9dc8ad1cd2f1236963b23d8c957c586e9b6736c8477001e393d4cff2fe9033c420752a5ce73e0ff3b18fe8881c647aa15ca447a9b899f3e3fd062aacb588b
7
+ data.tar.gz: e4337aed790fc7190cf0341dc158443d459b4aa0b85580594971362d38bef285fa8a6b9cae97e175a0d5f344964bc01a84778c34a042bb67bc364bde586f886e
data/lib/gameui/map.rb CHANGED
@@ -4,10 +4,14 @@ class ::Gameui::Map
4
4
  include Mongoid::Timestamps
5
5
 
6
6
  has_many :markers, :class_name => '::Gameui::Marker', inverse_of: :map
7
+ has_many :newsitems, inverse_of: :map
7
8
 
8
9
  field :slug
9
10
  validates :slug, uniqueness: true, presence: true
10
11
  field :parent_slug
12
+ def name
13
+ slug
14
+ end
11
15
 
12
16
  field :w, type: Integer
13
17
  validates :w, presence: true
@@ -26,5 +30,9 @@ class ::Gameui::Map
26
30
  field :ordering_type, type: String, default: 'custom' # timestamp, alphabetic, custom
27
31
  validates :ordering_type, presence: true
28
32
 
29
-
33
+ def self.list conditions = { is_trash: false }
34
+ out = self.order_by( created_at: :desc )
35
+ [['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
36
+ end
37
+
30
38
  end
@@ -39,6 +39,9 @@ class IshModels::UserProfile
39
39
  has_and_belongs_to_many :friendeds, :class_name => 'IshModels::UserProfile', :inverse_of => :friends
40
40
 
41
41
  field :n_unlocks, type: Integer, default: 0
42
+ def n_coins
43
+ n_unlocks
44
+ end
42
45
 
43
46
  #
44
47
  # preferences
@@ -72,7 +75,10 @@ class IshModels::UserProfile
72
75
  field :n_stars, type: Integer, default: 0
73
76
  has_many :premium_purchases, :class_name => '::Gameui::PremiumPurchase'
74
77
  def has_premium_purchase item
75
- item.premium_purchases.where( user_profile: self ).exists?
78
+ item.premium_purchases.where( user_profile_id: self.id ).exists?
79
+ end
80
+ def premium_purchases
81
+ ::Gameui::PremiumPurchase.where( user_profile_id: self.id )
76
82
  end
77
83
 
78
84
  end
data/lib/newsitem.rb CHANGED
@@ -7,7 +7,8 @@ class Newsitem
7
7
  belongs_to :city, :optional => true
8
8
  belongs_to :report, :optional => true
9
9
  belongs_to :user_profile, class_name: 'IshModels::UserProfile', optional: true
10
-
10
+ belongs_to :map, class_name: '::Gameui::Map', optional: true
11
+
11
12
  belongs_to :gallery, :optional => true
12
13
  def gallery
13
14
  self.gallery_id ? Gallery.unscoped.find( self.gallery_id ) : nil
@@ -43,7 +44,7 @@ class Newsitem
43
44
  unless item[:report_id].blank?
44
45
  n.report = Report.find item[:report_id]
45
46
  end
46
-
47
+
47
48
  unless item[:gallery_id].blank?
48
49
  n.gallery = Gallery.find item[:gallery_id]
49
50
  end
@@ -52,5 +53,5 @@ class Newsitem
52
53
 
53
54
  return n
54
55
  end
55
-
56
+
56
57
  end
data/lib/photo.rb CHANGED
@@ -10,37 +10,36 @@ class Photo
10
10
  # field :username, :type => String
11
11
 
12
12
  has_and_belongs_to_many :viewers, :class_name => 'User', :inverse_of => :viewable_photos
13
-
13
+
14
14
  belongs_to :user_profile, :class_name => 'IshModels::UserProfile', :optional => true
15
15
  def user; user_profile; end
16
16
  belongs_to :profile_city, :class_name => 'City', :inverse_of => :profile_photo, :optional => true
17
17
  belongs_to :profile_venue, :class_name => 'Venue', :inverse_of => :profile_photo, :optional => true
18
18
  belongs_to :profile_event, :class_name => 'Event', :inverse_of => :profile_photo, :optional => true
19
-
19
+
20
20
  belongs_to :report, :optional => true
21
21
  belongs_to :venue, :optional => true
22
22
  belongs_to :event, :optional => true
23
23
  belongs_to :feature, :optional => true
24
24
  belongs_to :gallery, :optional => true
25
25
  belongs_to :newsitem, :optional => true
26
-
26
+
27
27
  field :name, :type => String
28
28
  field :descr, :type => String
29
29
  field :weight, :type => Integer, :default => 10
30
-
30
+
31
31
  field :is_public, :type => Boolean, :default => true
32
32
 
33
33
  # @TODO: nuke this boolean _vp_ 20170515
34
34
  field :is_trash, :type => Boolean, :default => false
35
35
  default_scope ->{ where({ :is_trash => false }) }
36
36
 
37
- has_mongoid_attached_file :photo,
37
+ has_mongoid_attached_file :photo,
38
38
  :styles => {
39
39
  :mini => '20x20#',
40
40
  :thumb => "100x100#",
41
41
  :thumb2 => "200x200#",
42
42
  :s169 => "640x360#",
43
- # :s43 => "640x480#",
44
43
  :small => "400x400>",
45
44
  :large => '950x650>',
46
45
  },
@@ -48,14 +47,15 @@ class Photo
48
47
  :s3_credentials => ::S3_CREDENTIALS,
49
48
  :path => "photos/:style/:id/:filename",
50
49
  :s3_protocol => 'https',
51
- :validate_media_type => false
52
-
50
+ :validate_media_type => false,
51
+ s3_region: ::S3_CREDENTIALS[:region]
52
+
53
53
  def self.n_per_manager_gallery
54
54
  25
55
55
  end
56
56
 
57
57
  validates_attachment_content_type :photo, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
58
-
58
+
59
59
  end
60
60
 
61
61
 
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.129
4
+ version: 0.0.33.130
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox