Last active
October 25, 2018 22:10
-
-
Save andresprogra/c778f23ec0b6a6ca6e82a43147d59119 to your computer and use it in GitHub Desktop.
Test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Antes | |
line_chart = [] | |
@project.areas.uniq.each do |area| | |
activity_area = [] | |
area.project_areas.where(project_id: @project.id).group("DATE_TRUNC('day', created_at)").sum(:progress).each do |key, values| | |
activity_area << { value: values, date: key} | |
end | |
line_chart << { name: area.name, series: activity_area } | |
end | |
| |
# Despues | |
| |
| |
@project.areas.uniq.map do |area| | |
activity_area = area.project_areas.where(project_id: @project.id).group("DATE_TRUNC('day', created_at)").sum(:progress).map{ |key, item| { value: item, date: key} } | |
{ name: area.name, series: activity_area } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment