Module: HistoricalWeeklyStats

Defined in:
app/concerns/historical_weekly_stats.rb

Instance Method Summary collapse

Instance Method Details

#history_rangeObject



3
4
5
# File 'app/concerns/historical_weekly_stats.rb', line 3

def history_range
  @history_range ||= ((weeks_of_history - 1).weeks.before(this_week.begin))..this_week.end
end

#history_weeksObject



7
8
9
# File 'app/concerns/historical_weekly_stats.rb', line 7

def history_weeks
  @history_weeks ||= history_range.step(7)
end

#new_history_vectorObject



11
12
13
# File 'app/concerns/historical_weekly_stats.rb', line 11

def new_history_vector
  Hash[history_weeks.zip([0] * weeks_of_history)]
end