Module: PlanningDates
- Included in:
- CriticalChainPage, DecisionsOverview
- Defined in:
- lib/almirah/doc_types/planning_dates.rb
Overview
Shared date bucketing for the planning views (ADR-182): the recent Fridays a time-series trail is sampled on. Used by the overview's velocity chart and the Critical Chain page's fever-chart trail (ADR-196).
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.
11 12 13 14 15 16 |
# File 'lib/almirah/doc_types/planning_dates.rb', line 11 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 |