Module: PlanningDates
- Included in:
- DecisionsOverview
- Defined in:
- lib/almirah/doc_types/planning_dates.rb
Overview
Date bucketing for the overview's velocity chart: the recent Fridays its time-series trail is sampled on.
Instance Method Summary collapse
-
#recent_fridays(reference_date, count) ⇒ Object
countFridays ending at the Friday on or beforereference_date, oldest first.
Instance Method Details
#recent_fridays(reference_date, count) ⇒ Object
count Fridays ending at the Friday on or before reference_date, oldest
first.
10 11 12 13 14 15 |
# File 'lib/almirah/doc_types/planning_dates.rb', line 10 def recent_fridays(reference_date, count) friday_wday = 5 days_back = (reference_date.wday - friday_wday) % 7 most_recent = reference_date - days_back (0...count).to_a.reverse.map { |i| most_recent - (7 * i) } end |