workarea-reviews 3.0.9 → 3.0.10
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbc95c26a6972a59da6d0daa765491622783a60cfc8dd0961109b82839b0af77
|
4
|
+
data.tar.gz: 9f62f3d6484cdf8002172106970954fa053784844a6fa6084b2aee3baadf8e7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6913aca804eeb31ab4bb877b74b2826b50596e7b3a087eb162c49d46dc6df2a162ab8ca683e8251a1c056c798d12597294125acea2f102a91150baef4b31a4c
|
7
|
+
data.tar.gz: ab487315635024cb2fcbb3b6cea388188b01ad31e0cfbcaf6e9e9513f35f1ad53c035eeb67927bda4796265bf6459eed6b14028bec6faf22066c3257907df5a1
|
@@ -3,17 +3,26 @@ module Workarea
|
|
3
3
|
def perform
|
4
4
|
puts 'Adding reviews...'
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
Sidekiq::Callbacks.disable do
|
7
|
+
create_reviews_for_catalog
|
8
|
+
create_review_request_email_content
|
8
9
|
end
|
9
|
-
|
10
|
-
create_review_request_email_content
|
11
10
|
end
|
12
11
|
|
13
12
|
private
|
14
13
|
|
14
|
+
def create_reviews_for_catalog
|
15
|
+
Workarea::Catalog::Product.all.each_by(100) do |product|
|
16
|
+
reviews = Array.new(rand(10)) { create_review(product) }
|
17
|
+
next unless reviews.size > 0
|
18
|
+
|
19
|
+
Workarea::Review.collection.insert_many(reviews.map(&:as_document))
|
20
|
+
UpdateProductReviewData.perform_async(product.id)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
15
24
|
def create_review(product)
|
16
|
-
Workarea::Review.
|
25
|
+
Workarea::Review.new(
|
17
26
|
product_id: product.id,
|
18
27
|
user_id: BSON::ObjectId.new,
|
19
28
|
rating: rand(5) + 1,
|
@@ -21,7 +30,9 @@ module Workarea
|
|
21
30
|
body: Faker::Lorem.paragraph,
|
22
31
|
approved: [true, false].sample,
|
23
32
|
user_info: Faker::Internet.user_name,
|
24
|
-
verified: [true, false].sample
|
33
|
+
verified: [true, false].sample,
|
34
|
+
created_at: rand(45).days.ago,
|
35
|
+
updated_at: Time.current
|
25
36
|
)
|
26
37
|
end
|
27
38
|
|
@@ -4,7 +4,7 @@ module Workarea
|
|
4
4
|
module Storefront
|
5
5
|
class ReviewsHelperTest < ViewTest
|
6
6
|
def test_rating_stars_displays_correct_rating
|
7
|
-
assert_match(/1
|
7
|
+
assert_match(/1(?:\.0)? out of 5 stars/, rating_stars(1))
|
8
8
|
assert_match(/2\.5 out of 5 stars/, rating_stars(2.5))
|
9
9
|
assert_match(/4\.25 out of 5 stars/, rating_stars(4.251))
|
10
10
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workarea-reviews
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Crouse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: workarea
|
@@ -100,7 +100,7 @@ files:
|
|
100
100
|
- app/queries/workarea/search/admin_reviews.rb
|
101
101
|
- app/queries/workarea/search/category_browse.decorator
|
102
102
|
- app/queries/workarea/search/product_search.decorator
|
103
|
-
- app/seeds/
|
103
|
+
- app/seeds/review_seeds.rb
|
104
104
|
- app/services/workarea/create_review.rb
|
105
105
|
- app/view_models/workarea/admin/product_view_model.decorator
|
106
106
|
- app/view_models/workarea/admin/review_view_model.rb
|