spree_reviews_rating 1.0.4 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
Spree::Product.class_eval do
|
2
2
|
has_many :reviews
|
3
3
|
attr_accessible :avg_rating, :reviews_count
|
4
|
-
|
4
|
+
|
5
5
|
def get_stars
|
6
6
|
{:star => ((2.0 * self.avg_rating).round / 2.0), :rcount => reviews_count}
|
7
7
|
end
|
8
8
|
|
9
9
|
def recalculate_rating
|
10
10
|
reviews_count = reviews.reload.approved.where('rating IS NOT NULL').count
|
11
|
-
avg_rating = (reviews_count > 0) ? (self.reviews.approved.sum(:rating).to_f / reviews_count) : 0
|
11
|
+
self.avg_rating = (reviews_count > 0) ? (self.reviews.approved.sum(:rating).to_f / reviews_count) : 0
|
12
12
|
self.update_attributes(:avg_rating => avg_rating, :reviews_count => reviews_count)
|
13
|
-
end
|
14
|
-
|
13
|
+
end
|
15
14
|
end
|
data/app/models/spree/review.rb
CHANGED
data/lib/spree_reviews_rating.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_reviews_rating
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spree_core
|