Skip to content

Instantly share code, notes, and snippets.

@kaiwren
Created September 6, 2022 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaiwren/fc08ba960bfe1e25cd89fa01eb4f39b9 to your computer and use it in GitHub Desktop.
Save kaiwren/fc08ba960bfe1e25cd89fa01eb4f39b9 to your computer and use it in GitHub Desktop.
Generate a simple summary from a Jira full excel CSV export
require 'csv'
csv_file = ARGV[0]
def section_heading(title)
"\n#{'-' * 10} #{title} #{'-' * 10}\n\n"
end
rows = CSV.read(csv_file)[1..-1].map do |r|
created_at = DateTime.parse(r[21])
{
summary: r[0],
key: r[1],
type: r[3],
status: r[4],
assignee: r[13],
created: created_at,
age: (DateTime.now - created_at).to_i
}
end
ages = rows.inject({}) do |accumulator, r|
accumulator[r[:age]] ||= []
accumulator[r[:age]] << r[:key]
accumulator
end
types = rows.inject({}) do |accumulator, r|
assignee = r[:assignee]
accumulator[assignee] ||= {}
accumulator[assignee][r[:type]] ||= 0
accumulator[assignee][r[:type]] += 1
accumulator
end
statuses = rows.inject({}) do |accumulator, r|
assignee = r[:assignee]
accumulator[assignee] ||= {}
accumulator[assignee][r[:status]] ||= 0
accumulator[assignee][r[:status]] += 1
accumulator
end
puts section_heading('Card Ages')
pp ages
puts section_heading('Card Type Counts')
pp types
puts section_heading('Card Status Counts')
pp statuses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment