spree_reports 0.2.0 → 0.2.1
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d031c22ad008c1f4c061859c96379ae9d5c4d6f
|
4
|
+
data.tar.gz: 5208bf9eb2c99a58a6f230caf5371fffc7a740ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3d169f0a2500c56c4f00d4a1041a55244433ae4f6e046200995271b655e51145a47f6cd1284e33e44b04415889583c8e59727ef260db19b014ec9cce508dd6f
|
7
|
+
data.tar.gz: 1b7df621ac1f57c4739bfa196282fd11b567a5922be7baa8e5544a799c10a0fcd93aa1cd888198f8eec53f9c335967b32998ef522b08f2981a3f917c68d0da10
|
@@ -39,16 +39,18 @@
|
|
39
39
|
|
40
40
|
<table class="data" border="1">
|
41
41
|
<tr>
|
42
|
+
<th>Pos</th>
|
42
43
|
<th>Variant ID</th>
|
43
44
|
<th>Product Variant Name</th>
|
44
45
|
<th>Quantity</th>
|
45
46
|
</tr>
|
46
47
|
|
47
|
-
<% @report.data.
|
48
|
+
<% @report.data.each_with_index do |item, index| %>
|
48
49
|
<tr>
|
50
|
+
<td><%= index+1 %></td>
|
49
51
|
<td><%= item[:variant_id] %></td>
|
50
52
|
<td>
|
51
|
-
<%= link_to item[:variant_name], product_path(item[:variant_slug]) %>
|
53
|
+
<%= link_to item[:variant_name], product_path(item[:variant_slug]), class: item[:variant_available_on] > Time.now ? "red" : "" %>
|
52
54
|
<%= link_to "edit", admin_product_path(item[:variant_slug]) %>
|
53
55
|
</td>
|
54
56
|
<td><%= number_with_delimiter(item[:quantity]) %></td>
|
@@ -36,9 +36,17 @@ module SpreeReports
|
|
36
36
|
variant_ids_and_quantity = line_items.group(:variant_id).sum(:quantity).sort_by { |k,v| v }.reverse
|
37
37
|
|
38
38
|
variants = Spree::Variant.all
|
39
|
-
variant_names = variants.all.map { |v| [v.id, [variant_name_with_option_values(v), v.slug] ] }.to_h
|
39
|
+
variant_names = variants.all.map { |v| [v.id, [variant_name_with_option_values(v), v.slug, v.available_on] ] }.to_h
|
40
40
|
|
41
|
-
@data_tmp = variant_ids_and_quantity.map
|
41
|
+
@data_tmp = variant_ids_and_quantity.map do |id, quantity|
|
42
|
+
[
|
43
|
+
id,
|
44
|
+
quantity,
|
45
|
+
variant_names[id][0],
|
46
|
+
variant_names[id][1],
|
47
|
+
variant_names[id][2]
|
48
|
+
]
|
49
|
+
end
|
42
50
|
end
|
43
51
|
|
44
52
|
def build_response
|
@@ -47,6 +55,7 @@ module SpreeReports
|
|
47
55
|
variant_id: item[0],
|
48
56
|
variant_name: item[2],
|
49
57
|
variant_slug: item[3],
|
58
|
+
variant_available_on: item[4],
|
50
59
|
quantity: item[1]
|
51
60
|
}
|
52
61
|
end
|