smartkiosk-server 0.11.7 → 0.11.8
Sign up to get free protection for your applications and to get access to all the features.
- data/app/admin/report_results.rb +2 -2
- data/app/admin/reports.rb +1 -1
- data/app/models/gateway.rb +2 -0
- data/app/models/report_result.rb +8 -0
- data/app/reports/payments_report.rb +10 -1
- data/config/locales/smartkiosk.reports.ru.yml +3 -0
- data/lib/report_builder.rb +9 -0
- data/lib/smartkiosk/server/version.rb +1 -1
- metadata +2 -2
data/app/admin/report_results.rb
CHANGED
@@ -17,7 +17,7 @@ ActiveAdmin.register ReportResult do
|
|
17
17
|
|
18
18
|
result.each do |r|
|
19
19
|
row = []
|
20
|
-
fields.each{|f| row << r[f]}
|
20
|
+
fields.each{|f| row << report_result.human_field_value(f, r[f])}
|
21
21
|
ws.add_row row
|
22
22
|
end
|
23
23
|
end
|
@@ -56,7 +56,7 @@ ActiveAdmin.register ReportResult do
|
|
56
56
|
result.each do |row|
|
57
57
|
tr do
|
58
58
|
fields.each do |field|
|
59
|
-
td row[field]
|
59
|
+
td report_result.human_field_value(field, row[field])
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
data/app/admin/reports.rb
CHANGED
data/app/models/gateway.rb
CHANGED
data/app/models/report_result.rb
CHANGED
@@ -17,4 +17,12 @@ class ReportResult < ActiveRecord::Base
|
|
17
17
|
report_template.human_calculation_name field
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
def human_field_value(field, value)
|
22
|
+
if field.starts_with?('_')
|
23
|
+
report_template.report_builder.human_field_value(report.decode_field(field), value)
|
24
|
+
else
|
25
|
+
value
|
26
|
+
end
|
27
|
+
end
|
20
28
|
end
|
@@ -170,6 +170,12 @@ class PaymentsReport < ReportBuilder::Base
|
|
170
170
|
}
|
171
171
|
end
|
172
172
|
|
173
|
+
def field_localizations
|
174
|
+
{
|
175
|
+
'payment.state' => proc{|x| I18n.t("smartkiosk.payment_states.#{x}")}
|
176
|
+
}
|
177
|
+
end
|
178
|
+
|
173
179
|
def calculations
|
174
180
|
{
|
175
181
|
:quantity => lambda{|q, t| t.groupping.blank? ? q : q.project('COUNT(*) AS "quantity"') },
|
@@ -183,7 +189,10 @@ class PaymentsReport < ReportBuilder::Base
|
|
183
189
|
{
|
184
190
|
'payment.state' => proc { I18n.t('smartkiosk.payment_states') },
|
185
191
|
'payment.payment_type' => proc { I18n.t('smartkiosk.payment_types') },
|
186
|
-
'payment.provider_id' => proc { Provider.rmap.invert }
|
192
|
+
'payment.provider_id' => proc { Provider.rmap.invert },
|
193
|
+
'payment.agent_id' => proc { Agent.rmap.invert },
|
194
|
+
'payment.terminal_id' => proc { Terminal.rmap.invert },
|
195
|
+
'payment.gateway_id' => proc { Gateway.rmap.invert }
|
187
196
|
}
|
188
197
|
end
|
189
198
|
end
|
data/lib/report_builder.rb
CHANGED
@@ -95,6 +95,15 @@ module ReportBuilder
|
|
95
95
|
title.join(': ')
|
96
96
|
end
|
97
97
|
|
98
|
+
def human_field_value(field, value)
|
99
|
+
return value unless respond_to?(:field_localizations)
|
100
|
+
|
101
|
+
@localizations ||= field_localizations
|
102
|
+
return value unless @localizations[field]
|
103
|
+
|
104
|
+
@localizations[field].call(value)
|
105
|
+
end
|
106
|
+
|
98
107
|
def human_calculation_name(field)
|
99
108
|
I18n.t "smartkiosk.reports.data.#{keyword}.calculations.#{field}"
|
100
109
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartkiosk-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -333,7 +333,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
333
333
|
version: '0'
|
334
334
|
segments:
|
335
335
|
- 0
|
336
|
-
hash:
|
336
|
+
hash: 2701655485329085281
|
337
337
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
338
338
|
none: false
|
339
339
|
requirements:
|