workarea-core 3.4.21 → 3.4.22
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 +4 -4
- data/app/models/workarea/data_file/operation.rb +4 -0
- data/app/models/workarea/pricing/discount.rb +2 -1
- data/app/services/workarea/direct_upload.rb +5 -0
- data/app/workers/workarea/deactivate_stale_discounts.rb +1 -1
- data/config/locales/en.yml +22 -0
- data/lib/workarea/configuration.rb +1 -1
- data/lib/workarea/version.rb +1 -1
- data/test/models/workarea/data_file/csv_test.rb +15 -0
- data/test/services/workarea/direct_upload_test.rb +3 -0
- data/test/workers/workarea/deactivate_stale_discounts_test.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0ac39dbd2237a5eee6f5e178777a066ffd0a147ea8a44acf39bd9fbfae3a552
|
4
|
+
data.tar.gz: 33761ee41ab2947ceac2ba27e698691d620ff97b1312a70a0288c1838fc47e1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e7764b6fd43aa82afdb84c211ea9d52b21a1cc96d5bc4aba13ceb0f86811406fc0ae5921b86b3975fa162c03c7d4b1d5073563fe9e7f2af33be662f85af2014
|
7
|
+
data.tar.gz: 0aefa8eb85b5ae78cbd9fb503e94d80306ead3268fbf06b44e03982f686cc362cf35c1a455a42c7de05d1cc0eef1d02c5f9080edd85fe1cf3bec81ed48d1838f
|
@@ -92,6 +92,7 @@ module Workarea
|
|
92
92
|
class_name: 'Workarea::Pricing::Discount::Redemption'
|
93
93
|
|
94
94
|
index(active: 1)
|
95
|
+
index(updated_at: 1)
|
95
96
|
|
96
97
|
validates :name, presence: true
|
97
98
|
|
@@ -242,7 +243,7 @@ module Workarea
|
|
242
243
|
# @return [Time]
|
243
244
|
#
|
244
245
|
def auto_deactivates_at
|
245
|
-
start = last_redemption.try(:created_at) ||
|
246
|
+
start = last_redemption.try(:created_at) || updated_at
|
246
247
|
start + Workarea.config.discount_staleness_ttl
|
247
248
|
end
|
248
249
|
|
@@ -7,6 +7,9 @@ module Workarea
|
|
7
7
|
url = "#{uri.scheme}://#{uri.host}"
|
8
8
|
url += ":#{uri.port}" unless uri.port.in? [80, 443]
|
9
9
|
|
10
|
+
redis_key = "cors_#{url.optionize}"
|
11
|
+
return if Workarea.redis.get(redis_key) == 'true'
|
12
|
+
|
10
13
|
Workarea.s3.put_bucket_cors(
|
11
14
|
Configuration::S3.bucket,
|
12
15
|
'CORSConfiguration' => [
|
@@ -18,6 +21,8 @@ module Workarea
|
|
18
21
|
}
|
19
22
|
]
|
20
23
|
)
|
24
|
+
|
25
|
+
Workarea.redis.set(redis_key, 'true')
|
21
26
|
end
|
22
27
|
|
23
28
|
attr_reader :type, :filename
|
data/config/locales/en.yml
CHANGED
@@ -50,6 +50,28 @@ en:
|
|
50
50
|
unit: instance
|
51
51
|
csv:
|
52
52
|
unit: row
|
53
|
+
duration:
|
54
|
+
years:
|
55
|
+
one: '%{count} year'
|
56
|
+
other: '%{count} years'
|
57
|
+
months:
|
58
|
+
one: '%{count} month'
|
59
|
+
other: '%{count} months'
|
60
|
+
weeks:
|
61
|
+
one: '%{count} week'
|
62
|
+
other: '%{count} weeks'
|
63
|
+
days:
|
64
|
+
one: '%{count} day'
|
65
|
+
other: '%{count} days'
|
66
|
+
hours:
|
67
|
+
one: '%{count} hour'
|
68
|
+
other: '%{count} hours'
|
69
|
+
minutes:
|
70
|
+
one: '%{count} minute'
|
71
|
+
other: '%{count} minutes'
|
72
|
+
seconds:
|
73
|
+
one: '%{count} second'
|
74
|
+
other: '%{count} seconds'
|
53
75
|
errors:
|
54
76
|
messages:
|
55
77
|
contains_type: cannot contain 'type'
|
@@ -1267,7 +1267,7 @@ module Workarea
|
|
1267
1267
|
# setting to configure the `:encoding` options for `CSV.foreach`
|
1268
1268
|
# if your CSV files are failing to import with a UTF-8 encoding
|
1269
1269
|
# error.
|
1270
|
-
config.csv_import_options = {}
|
1270
|
+
config.csv_import_options = { encoding: 'bom|utf-8' }
|
1271
1271
|
end
|
1272
1272
|
end
|
1273
1273
|
end
|
data/lib/workarea/version.rb
CHANGED
@@ -403,6 +403,21 @@ module Workarea
|
|
403
403
|
assert_equal("Bowl Light\u0099", product.name)
|
404
404
|
end
|
405
405
|
end
|
406
|
+
|
407
|
+
def test_bom_characters_in_unicode
|
408
|
+
csv = %(\xEF\xBB\xBF_id,name,slug,details_keywords\n653911,Bowl Light,Bowl_Light,"testing")
|
409
|
+
import = create_import(
|
410
|
+
model_type: Catalog::Product.name,
|
411
|
+
file: create_tempfile(csv, extension: 'csv'),
|
412
|
+
file_type: 'csv'
|
413
|
+
)
|
414
|
+
|
415
|
+
Csv.new(import).import!
|
416
|
+
|
417
|
+
product = Catalog::Product.find_by(slug: 'bowl_light')
|
418
|
+
|
419
|
+
assert_equal('653911', product.id)
|
420
|
+
end
|
406
421
|
end
|
407
422
|
end
|
408
423
|
end
|
@@ -83,8 +83,11 @@ module Workarea
|
|
83
83
|
|
84
84
|
|
85
85
|
assert(DirectUpload.ensure_cors!('http://test.host/admin/content_assets'))
|
86
|
+
assert_equal('true', Workarea.redis.get('cors_http_test_host'))
|
86
87
|
assert(DirectUpload.ensure_cors!('http://localhost:3000/admin/content_assets'))
|
88
|
+
assert_equal('true', Workarea.redis.get('cors_http_localhost_3000'))
|
87
89
|
assert(DirectUpload.ensure_cors!('https://example.com/admin/direct_uploads'))
|
90
|
+
assert_equal('true', Workarea.redis.get('cors_https_example_com'))
|
88
91
|
end
|
89
92
|
|
90
93
|
private
|
@@ -4,7 +4,7 @@ module Workarea
|
|
4
4
|
class DeactivateStaleDiscountsTest < TestCase
|
5
5
|
def create_category_discount(attributes = {})
|
6
6
|
before_ttl = (Workarea.config.discount_staleness_ttl + 1.day).ago
|
7
|
-
super(attributes.reverse_merge(
|
7
|
+
super(attributes.reverse_merge(updated_at: before_ttl))
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_perform
|
@@ -71,7 +71,7 @@ module Workarea
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def test_all_active_discount_ids
|
74
|
-
too_new = create_category_discount(active: true,
|
74
|
+
too_new = create_category_discount(active: true, updated_at: Time.current)
|
75
75
|
active = create_category_discount(active: true)
|
76
76
|
|
77
77
|
worker = DeactivateStaleDiscounts.new
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workarea-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.22
|
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-
|
11
|
+
date: 2019-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|