ish_models 0.0.33.169 → 0.0.33.172
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gameui/map.rb +6 -2
- data/lib/mongoid/votable.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5769b6b8a2b8a37d133dc1f7b189ae2c57dfaa027ac75eeb1504fdf43ea625e
|
4
|
+
data.tar.gz: 93bb7323be666fe6c16be74bf092459d371f9b35c393d846e1028a9efcc22dd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 757dc8e96ba6f354039339b66f85a4e5a6bd7ff34405fd41621216330848bcccbbdf0c3093adea3d9434e06b70aeee1ba452fef5214bebf4483d3a06baba3ef7
|
7
|
+
data.tar.gz: 4e9bfc050504f1b79fc19c0ec977bf96ed2ffcd28067457dc1828c3b52d45fe779a0bf2358c258ff81cd954719f31e01c782525c90a672cd8c31f0d74ae99872
|
data/lib/gameui/map.rb
CHANGED
@@ -17,10 +17,11 @@ class ::Gameui::Map
|
|
17
17
|
field :slug
|
18
18
|
validates :slug, uniqueness: true, presence: true
|
19
19
|
|
20
|
+
# @TODO: remove field, replace with relation. _vp_ 2022-09-13
|
20
21
|
field :parent_slug
|
21
|
-
|
22
22
|
belongs_to :parent, class_name: '::Gameui::Map', inverse_of: :childs, optional: true
|
23
23
|
has_many :childs, class_name: '::Gameui::Map', inverse_of: :parent
|
24
|
+
|
24
25
|
has_one :image, class_name: '::Ish::ImageAsset', inverse_of: :location
|
25
26
|
belongs_to :creator_profile, class_name: '::Ish::UserProfile', inverse_of: :my_maps
|
26
27
|
|
@@ -33,7 +34,7 @@ class ::Gameui::Map
|
|
33
34
|
|
34
35
|
field :version, type: String, default: '0.0.0'
|
35
36
|
|
36
|
-
## @TODO:
|
37
|
+
## @TODO: or self, right? and refactor this, seems N+1. _vp_ 2022-09-13
|
37
38
|
field :map_slug
|
38
39
|
def map
|
39
40
|
::Gameui::Map.where( slug: map_slug ).first
|
@@ -59,6 +60,9 @@ class ::Gameui::Map
|
|
59
60
|
field :h, type: Integer
|
60
61
|
validates :h, presence: true
|
61
62
|
|
63
|
+
MAP_TYPES = [ :map_2d, :map_3d, :map_geospatial, :map_gallery, :map_toc ] ## Mostly not implemented. _vp_ 2022-09-06
|
64
|
+
field :map_type, default: :map_2d
|
65
|
+
|
62
66
|
## @TODO: abstract this into a module
|
63
67
|
field :x, :type => Float
|
64
68
|
field :y, :type => Float
|
data/lib/mongoid/votable.rb
CHANGED
@@ -190,7 +190,7 @@ module Mongoid
|
|
190
190
|
#
|
191
191
|
# @param [Mongoid Object, BSON::ObjectId] voter is Mongoid object the id of the voter who made the vote
|
192
192
|
def vote_value(voter)
|
193
|
-
voter_id = voter.is_a?(BSON::ObjectId) ? voter : voter.is_a?(String) ? voter : voter.id
|
193
|
+
voter_id = voter.is_a?(BSON::ObjectId) ? voter.to_s : voter.is_a?(String) ? voter : voter.id.to_s
|
194
194
|
|
195
195
|
return :up if up_voter_ids.try(:include?, voter_id)
|
196
196
|
return :down if down_voter_ids.try(:include?, voter_id)
|