mochigome 0.1.17 → 0.1.18

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.
Files changed (3) hide show
  1. data/lib/mochigome_ver.rb +1 -1
  2. data/lib/query.rb +11 -2
  3. metadata +3 -3
data/lib/mochigome_ver.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mochigome
2
- VERSION = "0.1.17"
2
+ VERSION = "0.1.18"
3
3
  end
data/lib/query.rb CHANGED
@@ -90,6 +90,11 @@ module Mochigome
90
90
  ActiveRecord::Base.connection
91
91
  end
92
92
 
93
+ # TODO: Write a test for situations that use this
94
+ def denilify(v)
95
+ (v.nil? || v.to_s.strip.empty?) ? "(None)" : v
96
+ end
97
+
93
98
  def create_node_tree(cond)
94
99
  root = DataNode.new(:report, @name)
95
100
  root.comment = <<-eos
@@ -106,7 +111,11 @@ module Mochigome
106
111
  r.apply_condition(cond)
107
112
  ids_sql = r.to_sql
108
113
  if ids_sql
109
- ids_table = connection.select_all(ids_sql)
114
+ ids_table = connection.select_all(ids_sql).map do |row|
115
+ row.each do |k,v|
116
+ row[k] = denilify(v)
117
+ end
118
+ end
110
119
  fill_layers(ids_table, {[] => root}, @layer_types)
111
120
  end
112
121
 
@@ -161,7 +170,7 @@ module Mochigome
161
170
  q = rel_func.call(cond)
162
171
  data_tree = {}
163
172
  connection.select_all(q.to_sql).each do |row|
164
- group_values = row.keys.select{|k| k.start_with?("g")}.sort.map{|k| row[k]}
173
+ group_values = row.keys.select{|k| k.start_with?("g")}.sort.map{|k| denilify(row[k])}
165
174
  data_values = row.keys.select{|k| k.start_with?("d")}.sort.map{|k| row[k]}
166
175
  if group_values.empty?
167
176
  data_tree = data_values
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mochigome
3
3
  version: !ruby/object:Gem::Version
4
- hash: 57
4
+ hash: 63
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 17
10
- version: 0.1.17
9
+ - 18
10
+ version: 0.1.18
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Mike Simon