Class: ProjectsByPeriod
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ProjectsByPeriod
- Defined in:
- app/models/projects_by_period.rb
Class Method Summary collapse
Class Method Details
.chart ⇒ Object
2 3 4 5 6 7 8 |
# File 'app/models/projects_by_period.rb', line 2 def self.chart self.all.reduce([]) do |memo, row| memo << {name: I18n.t("adm.statistics.projects_by_week.#{row.series}"), data: {}} unless memo.last && memo.last[:name] == I18n.t("adm.statistics.projects_by_week.#{row.series}") memo.last[:data][Date.today - (row[:week] * 7).days] = row[:count] memo end end |