lib/mountain-goat/controllers/mg/goals_controller.rb in mountain-goat-1.0.2 vs lib/mountain-goat/controllers/mg/goals_controller.rb in mountain-goat-1.0.3
- old
+ new
@@ -26,25 +26,22 @@
@results_per_day.push({ :date => running_date.to_i * 1000, :val => @goal.mg_records.find( :all, :conditions => { :created_at => running_date..(running_date + 60 * 60 * 24) } ).count })
running_date += 60 * 60 * 24
end
@results_by_gmt = {}
- @results_by_gmt_titles = {}
@goal.mg_goal_meta_types.each do |gmt|
@results_by_gmt[gmt.id] = []
- @results_by_gmt_titles[gmt.id] = {}
- i = 0
+
gmt.meta.all(:select => "data, count(*) as count", :group => "data").each do |meta|
next if meta.data.nil?
if gmt.meta_type == 'cs_meta' || gmt.meta_type == 'gs_meta'
- @results_by_gmt[gmt.id].push( { :name => i, :val => meta.count } )
- @results_by_gmt_titles[gmt.id].merge!({ i => meta.data })
+ @results_by_gmt[gmt.id].push( { :name => meta.data, :val => meta.count, :title => meta.data } )
+ #@results_by_gmt_titles[gmt.id].merge!({ i => meta.data })
else
- @results_by_gmt[gmt.id].push( { :name => meta.data, :val => meta.count } )
+ @results_by_gmt[gmt.id].push( { :name => meta.data, :val => meta.count, :title => meta.data } )
end
- i += 1
end
end
respond_to do |format|
format.html # show.html.erb