Module: CSVData

Included in:
Monte::Commands::Carlo
Defined in:
lib/monte/csv_data.rb

Overview

This module supports parsing an export of Jira data to build a sample of historic throughputs that provide a more accurate forecast It takes the absolute path to the csv export and returns an array containing the number of tasks/tickets completed each week

Constant Summary collapse

RESOLVED =
'Resolved'

Instance Method Summary collapse

Instance Method Details

#historic_throughput(path) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/monte/csv_data.rb', line 12

def historic_throughput(path)
  headers, *data = CSV.read(path)
  resolved_column = headers.index(RESOLVED)
  resolved_dates = data.flat_map { |row| Date.parse row[resolved_column] }
  grouped_into_weeks = resolved_dates.group_by { |date| date - date.wday }
  grouped_into_weeks.values.map(&:length)
end