workarea-core 3.5.15 → 3.5.16
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/checkout.rb +1 -5
- data/app/models/workarea/inventory/sku.rb +2 -2
- data/app/models/workarea/metrics/user.rb +24 -8
- data/app/models/workarea/order.rb +10 -0
- data/app/models/workarea/payment.rb +1 -6
- data/lib/workarea/configuration.rb +11 -0
- data/lib/workarea/configuration/administrable_options.rb +1 -5
- data/lib/workarea/version.rb +1 -1
- 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: 569f33ae16d992354fca8761ef67ed5473a12755dda710cfff057ebd2d7aa2b4
|
4
|
+
data.tar.gz: 24b32513e4215b2aa1c67a5f1d930ae5f8a81ee098be08234eab95f69a6bc574
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11b65e3f2de7268ec497fecb2019a10133e2a477cc5bf06cd64390976098baa97277a75a295633a4fd6e43b221d31453c6a4da99b1c05012534e19621a6c7d18
|
7
|
+
data.tar.gz: 614ed5b1d7970082ba8eb48b8448434737d194ed1fed7158537774b9e46dce862ab0cae2faafca35f40378a061e3a91c02b9ab4d36875201896ea33ff6b60991
|
@@ -47,11 +47,7 @@ module Workarea
|
|
47
47
|
def inventory
|
48
48
|
@inventory ||= Inventory::Transaction.from_order(
|
49
49
|
order.id,
|
50
|
-
order.
|
51
|
-
memo[item.sku] ||= 0
|
52
|
-
memo[item.sku] += item.quantity
|
53
|
-
memo
|
54
|
-
end
|
50
|
+
order.sku_quantities
|
55
51
|
)
|
56
52
|
end
|
57
53
|
|
@@ -142,11 +142,11 @@ module Workarea
|
|
142
142
|
end
|
143
143
|
|
144
144
|
def policy_class
|
145
|
-
"Workarea::Inventory::Policies::#{policy.
|
145
|
+
"Workarea::Inventory::Policies::#{policy.camelize}".constantize
|
146
146
|
rescue NameError
|
147
147
|
raise(
|
148
148
|
InvalidPolicy,
|
149
|
-
"Workarea::Inventory::Policies::#{policy.
|
149
|
+
"Workarea::Inventory::Policies::#{policy.camelize} must be a policy class"
|
150
150
|
)
|
151
151
|
end
|
152
152
|
|
@@ -110,14 +110,28 @@ module Workarea
|
|
110
110
|
end
|
111
111
|
|
112
112
|
def merge!(other)
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
113
|
+
# To recalculate average_order_value
|
114
|
+
self.orders += other.orders
|
115
|
+
self.revenue += other.revenue
|
116
|
+
|
117
|
+
update = {
|
118
|
+
'$set' => {
|
119
|
+
average_order_value: average_order_value,
|
120
|
+
updated_at: Time.current.utc
|
121
|
+
},
|
122
|
+
'$inc' => {
|
123
|
+
orders: other.orders,
|
124
|
+
revenue: other.revenue,
|
125
|
+
discounts: other.discounts,
|
126
|
+
cancellations: other.cancellations,
|
127
|
+
refund: other.refund
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
131
|
+
update['$min'] = { first_order_at: other.first_order_at.utc } if other.first_order_at.present?
|
132
|
+
update['$max'] = { last_order_at: other.last_order_at.utc } if other.last_order_at.present?
|
133
|
+
|
134
|
+
self.class.collection.update_one({ _id: id }, update, upsert: true)
|
121
135
|
|
122
136
|
self.class.save_affinity(
|
123
137
|
id: id,
|
@@ -133,6 +147,8 @@ module Workarea
|
|
133
147
|
category_ids: other.purchased.category_ids,
|
134
148
|
search_ids: other.purchased.search_ids
|
135
149
|
)
|
150
|
+
|
151
|
+
reload
|
136
152
|
end
|
137
153
|
end
|
138
154
|
end
|
@@ -375,6 +375,16 @@ module Workarea
|
|
375
375
|
)
|
376
376
|
end
|
377
377
|
|
378
|
+
# A hash with the quantity of each SKU in the order
|
379
|
+
#
|
380
|
+
# @return [Hash]
|
381
|
+
#
|
382
|
+
def sku_quantities
|
383
|
+
items.each_with_object(Hash.new(0)) do |item, quantities|
|
384
|
+
quantities[item.sku] += item.quantity
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
378
388
|
private
|
379
389
|
|
380
390
|
def item_count_limit
|
@@ -80,12 +80,7 @@ module Workarea
|
|
80
80
|
build_credit_card unless credit_card
|
81
81
|
credit_card.saved_card_id = nil
|
82
82
|
credit_card.attributes = attrs.slice(
|
83
|
-
|
84
|
-
:year,
|
85
|
-
:saved_card_id,
|
86
|
-
:number,
|
87
|
-
:cvv,
|
88
|
-
:amount
|
83
|
+
*Workarea.config.credit_card_attributes
|
89
84
|
)
|
90
85
|
save
|
91
86
|
end
|
@@ -1297,6 +1297,17 @@ module Workarea
|
|
1297
1297
|
|
1298
1298
|
# The number of results that will show per-type in the admin jump to
|
1299
1299
|
config.jump_to_results_per_type = 5
|
1300
|
+
|
1301
|
+
# Attributes that will be sliced out of params and persisted on
|
1302
|
+
# the credit card tender during checkout.
|
1303
|
+
config.credit_card_attributes = %i[
|
1304
|
+
month
|
1305
|
+
year
|
1306
|
+
saved_card_id
|
1307
|
+
number
|
1308
|
+
cvv
|
1309
|
+
amount
|
1310
|
+
]
|
1300
1311
|
end
|
1301
1312
|
end
|
1302
1313
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Workarea
|
2
2
|
module Configuration
|
3
3
|
class AdministrableOptions < ActiveSupport::InheritableOptions
|
4
|
-
def
|
4
|
+
def [](name)
|
5
5
|
static_config = super
|
6
6
|
return static_config if static_config.present? || static_config.to_s == 'false'
|
7
7
|
return static_config unless check_fieldsets?(name)
|
@@ -9,10 +9,6 @@ module Workarea
|
|
9
9
|
Configuration::Admin.instance.send(name)
|
10
10
|
end
|
11
11
|
|
12
|
-
def respond_to_missing?(name, include_private)
|
13
|
-
true
|
14
|
-
end
|
15
|
-
|
16
12
|
private
|
17
13
|
|
18
14
|
def check_fieldsets?(name)
|
data/lib/workarea/version.rb
CHANGED
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.5.
|
4
|
+
version: 3.5.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Crouse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|