forest_liana 2.5.4 → 2.5.5
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5214128ae98854ef7c971f1dcab51b1ccaf4ed42
|
4
|
+
data.tar.gz: aa5a5656d07a4156fdf6bd486436c01e93abf23e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4465170c5c167630fb5a6cd90c2b723219f375c9b34ed0163cc6cd0b54f417793c4692ca1134d88ee46f482d8d071daae182850487ec99be847061a481a07d78
|
7
|
+
data.tar.gz: '0322564698c541a518da0c69aa8138f4b9733ea5906624d9458cbfe030d0bfcbc9f05d34c4551a4e60a1bdd515435f78df7e9ab631007b307dd9cc666ba812e2'
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module ForestLiana
|
2
2
|
module AdapterHelper
|
3
|
+
ADAPTER_MYSQL2 = 'Mysql2'
|
4
|
+
|
3
5
|
def self.format_column_name(table_name, column_name)
|
4
6
|
quoted_table_name = ActiveRecord::Base.connection.quote_table_name(table_name)
|
5
7
|
quoted_column_name = ActiveRecord::Base.connection.quote_column_name(column_name)
|
@@ -13,5 +15,35 @@ module ForestLiana
|
|
13
15
|
value
|
14
16
|
end
|
15
17
|
end
|
18
|
+
|
19
|
+
def self.format_live_query_value_result(result)
|
20
|
+
# NOTICE: The adapters have their own specific format for the live query value chart results.
|
21
|
+
case ActiveRecord::Base.connection.adapter_name
|
22
|
+
when ADAPTER_MYSQL2
|
23
|
+
{ 'value' => result.first.first }
|
24
|
+
else
|
25
|
+
result.first
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.format_live_query_pie_result(result)
|
30
|
+
# NOTICE: The adapters have their own specific format for the live query pie chart results.
|
31
|
+
case ActiveRecord::Base.connection.adapter_name
|
32
|
+
when ADAPTER_MYSQL2
|
33
|
+
result.map { |value| { 'key' => value[0], 'value' => value[1] } }
|
34
|
+
else
|
35
|
+
result.to_a
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.format_live_query_line_result(result)
|
40
|
+
# NOTICE: The adapters have their own specific format for the live query line chart results.
|
41
|
+
case ActiveRecord::Base.connection.adapter_name
|
42
|
+
when ADAPTER_MYSQL2
|
43
|
+
result.map { |value| { 'key' => value[0], 'value' => value[1] } }
|
44
|
+
else
|
45
|
+
result
|
46
|
+
end
|
47
|
+
end
|
16
48
|
end
|
17
49
|
end
|
@@ -22,7 +22,7 @@ module ForestLiana
|
|
22
22
|
case @params['type']
|
23
23
|
when 'Value'
|
24
24
|
if result.count
|
25
|
-
result_line = result
|
25
|
+
result_line = ForestLiana::AdapterHelper.format_live_query_value_result(result)
|
26
26
|
if result_line
|
27
27
|
if !result_line.key?('value')
|
28
28
|
raise error_message(result_line, "'value'")
|
@@ -38,23 +38,27 @@ module ForestLiana
|
|
38
38
|
end
|
39
39
|
when 'Pie'
|
40
40
|
if result.count
|
41
|
-
|
41
|
+
values = ForestLiana::AdapterHelper.format_live_query_pie_result(result)
|
42
|
+
|
43
|
+
values.each do |result_line|
|
42
44
|
if !result_line.key?('value') || !result_line.key?('key')
|
43
45
|
raise error_message(result_line, "'key', 'value'")
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
47
|
-
@record = Model::Stat.new(value:
|
49
|
+
@record = Model::Stat.new(value: values)
|
48
50
|
end
|
49
51
|
when 'Line'
|
50
52
|
if result.count
|
51
|
-
|
53
|
+
values = ForestLiana::AdapterHelper.format_live_query_line_result(result)
|
54
|
+
|
55
|
+
values.each do |result_line|
|
52
56
|
if !result_line.key?('value') || !result_line.key?('key')
|
53
57
|
raise error_message(result_line, "'key', 'value'")
|
54
58
|
end
|
55
59
|
end
|
56
60
|
|
57
|
-
result_formatted =
|
61
|
+
result_formatted = values.map do |result_line|
|
58
62
|
{ label: result_line['key'], values: { value: result_line['value'] }}
|
59
63
|
end
|
60
64
|
|
data/lib/forest_liana/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forest_liana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sandro Munda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|