lib/journal-cli/checkin.rb in journal-cli-1.0.14 vs lib/journal-cli/checkin.rb in journal-cli-1.0.15
- old
+ new
@@ -212,30 +212,26 @@
@data.each do |jk, journal|
output[jk] = {}
journal.answers.each do |k, v|
if v.is_a? Hash
- output[jk][k] = {}
-
v.each do |key, value|
result = case value.class.to_s
when /Weather/
{ 'high' => value.data[:high], 'low' => value.data[:low], 'condition' => value.data[:condition] }
else
value
end
if jk == k
- output[jk] = result
+ output[jk][key] = result
else
- output[jk][k] = result
+ output[jk][k][key] = result
end
end
+ elsif jk == k
+ output[jk] = v
else
- if jk == k
- output[jk] = v
- else
- output[jk][k] = v
- end
+ output[jk][k] = v
end
end
end
data << { 'date' => date, 'data' => output }
data.map! do |d|