seems_rateable 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/seems_rateable/record.rb +3 -3
- data/lib/seems_rateable/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
ZWNkMTk4N2JjOTk5ZTkzMTNkZmVmNGNkMzg0NmYwYTZiNjBiNDExMQ==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
YjdmZWZiMzFkMDc1ODI3ODgzNjQ3ZTA0MzlhMDhmMGIwMWVhNDcxNg==
|
|
7
7
|
!binary "U0hBNTEy":
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
NzM3ZDI4ZjdhZGU2M2I1NGQ3OWNiNDViYWZlYzRkN2U3NTIzZjM3ZDE0Yjc0
|
|
10
|
+
OGI2NDkyOWVlMTZmNzUxMjMwYjhjNGQ3MDYxNjI4Yjc3MDAzZTdkNWY2ZGRh
|
|
11
|
+
ZDQ1MzFmNWQwY2NjOGVhODU3NWI5NTA2MmM1NmE3ZjQyYTM5MzY=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
MTQzYTUwYjNiOGFjYjY1MDc2NTU5ZDllNzVkMWNmN2FlZmM4ZjE0MzA0YTZk
|
|
14
|
+
ZjQzZjZlZGNiYjMzNGUzYzZkNTUyOWE5Y2I0MmUyMTkwYjQ3NDNkYmFlODE0
|
|
15
|
+
MTVjMzhiZWFiZWQzYTJkMjlhYTUxMGEyZTMyMzVlZDg3ODNhMGY=
|
|
@@ -41,7 +41,7 @@ module SeemsRateable
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
def allow_update_average(stars, user_id, dimension=nil)
|
|
44
|
-
obj = rates(dimension).where(:rater_id => user_id
|
|
44
|
+
obj = rates(dimension).where(:rater_id => user_id).first!
|
|
45
45
|
r = average(dimension)
|
|
46
46
|
r.avg = (r.avg*r.cnt - obj.stars + stars) / (r.cnt)
|
|
47
47
|
r.save!
|
|
@@ -60,8 +60,8 @@ module SeemsRateable
|
|
|
60
60
|
|
|
61
61
|
def permission(user_id, dimension=nil)
|
|
62
62
|
#record = connection.select_one("SELECT id FROM rates WHERE rateable_id=#{self.id} and rateable_type='#{self.class.name}' and rater_id=#{user_id} and dimension#{dimension ? "='#{dimension.to_s}'" : " IS NULL"}")
|
|
63
|
-
record = Rate.where(:rateable_id => self.id, :rateable_type => self.class.name, :rater_id => user_id, :dimension => dimension)
|
|
64
|
-
record ?
|
|
63
|
+
record = Rate.where(:rateable_id => self.id, :rateable_type => self.class.name, :rater_id => user_id, :dimension => dimension)
|
|
64
|
+
record.empty? ? true : false
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
def rates(dimension=nil)
|