ish_models 0.0.33.230 → 0.0.33.231

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/photo.rb +1 -2
  3. data/lib/report.rb +5 -22
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b6e8cdb5d6318f3571949e0b6bd148bf3bfba895c0f7c53f2744caf060876e0
4
- data.tar.gz: 4c8ff28513a7c4deb978a39ac728729b6b5a10a43ea2e7e13553905655bdf423
3
+ metadata.gz: f7a90237b3ffeec198b9d6732898d879fbc4b1958f66caa722bdb4902222f408
4
+ data.tar.gz: 72ee5abe32d9966fb5a82d5bfc3c147a0ca20e5892a8c412eee838c1e8aefaf1
5
5
  SHA512:
6
- metadata.gz: 2f6c720885cd4e0b322ee54862fefba63a9d7af7e993c455dd942ec0b1f8aabfcbd9599362e5887bb0e325fd18cfad0c47f193ee7db8f31f7a5f1dae98ba6afd
7
- data.tar.gz: 3e906a2d06e5b4ba91f7cf194cec788c8161d36930bab21fc516a6a47a100e142011ab6609f2fefbd1d17ffdfaa388845793e28ebee3b88e67af8131dd096e1b
6
+ metadata.gz: 6ecc759ec798a3e34e7d422b601059012cf9291418fe049925fb86c9bd23cf2e1362f4278853173361608aacc54f201c41270ae4516988e81f0791de35a7b140
7
+ data.tar.gz: f0b6519444a7eca6208dd5d31bdb266737a3223a7f57ba3643318d3285e02b074bd1334c08e076469df03f13c821ae9b40c1885602be51819650c15a79422b71
data/lib/photo.rb CHANGED
@@ -15,7 +15,6 @@ class Photo
15
15
  belongs_to :user_profile, :class_name => 'Ish::UserProfile', :inverse_of => :profile_photo, :optional => true
16
16
 
17
17
  belongs_to :report, :optional => true
18
- belongs_to :feature, :optional => true
19
18
  belongs_to :gallery, :optional => true
20
19
  belongs_to :newsitem, :optional => true
21
20
 
@@ -36,7 +35,7 @@ class Photo
36
35
 
37
36
  field :is_public, :type => Boolean, :default => true
38
37
  field :is_trash, :type => Boolean, :default => false # @TODO: nuke this boolean _vp_ 20170515
39
- default_scope ->{ where({ :is_trash => false }) } # @TODO: nuke default scopes
38
+ default_scope ->{ where({ :is_trash => false }) }
40
39
 
41
40
  has_mongoid_attached_file :photo,
42
41
  :styles => {
data/lib/report.rb CHANGED
@@ -6,7 +6,6 @@ class Report
6
6
 
7
7
  field :name, :type => String
8
8
  validates :name, :presence => true
9
- # index({ :name => 1 }, { :unique => true })
10
9
  index({ :name => 1, :is_trash => 1 })
11
10
 
12
11
  field :slug
@@ -14,6 +13,8 @@ class Report
14
13
  index({ :slug => 1 }, { :unique => true })
15
14
  before_validation :set_slug, :on => :create
16
15
 
16
+ field :subhead
17
+
17
18
  ## Can be one of: default (nil), longscroll,
18
19
  ## wordpress e.g. https://piousbox.com/wp-json/wp/v2/posts?slug=intro
19
20
  # ITEM_TYPES = %w| longscroll wordpress |
@@ -23,41 +24,23 @@ class Report
23
24
  field :raw_json
24
25
 
25
26
  field :is_trash, :type => Boolean, :default => false
26
- index({ :is_trash => 1, :is_public => 1 }, { name: 'default_index' })
27
+ index({ :is_trash => 1, :is_public => 1 })
27
28
 
28
29
  field :is_public, :type => Boolean, :default => true
29
30
  index({ :is_public => 1 })
30
31
  scope :public, ->{ where({ is_public: true }) }
31
32
 
32
- field :is_feature, :type => Boolean, :default => false
33
- index({ :is_feature => 1 })
34
-
35
- field :is_done, :type => Boolean, :default => true
36
- index({ :is_done => 1 })
37
-
38
33
  field :x, :type => Float
39
34
  field :y, :type => Float
40
-
41
- field :lang, :type => String, :default => 'en'
42
- index({ :lang => 1 })
35
+ field :z, :type => Float
43
36
 
44
37
  belongs_to :user_profile, :optional => true, :class_name => 'Ish::UserProfile'
45
38
 
46
- # validates :user, :presence => true, :allow_nil => false
47
- field :username, :type => String, :default => 'anonymous'
48
- validates :username, :presence => true, :allow_nil => false
49
- index({ :username => 1 })
50
-
51
- field :issue
52
- field :subhead
53
-
54
39
  has_one :photo
55
40
 
56
- field :n_upvotes, :default => 0
57
- field :n_spamvotes, :default => 0
58
-
59
41
  has_many :newsitems
60
42
 
43
+ ## @TODO: trash, remove
61
44
  def self.list conditions = { :is_trash => false }
62
45
  out = self.where( conditions ).order_by( :name => :asc ).limit( 100 )
63
46
  [['', nil]] + out.map { |item| [ item.name, item.id ] }
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.230
4
+ version: 0.0.33.231
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox