lib/how_is/report.rb in how_is-2.0.0 vs lib/how_is/report.rb in how_is-3.0.0
- old
+ new
@@ -16,20 +16,23 @@
def to_json
to_h.to_json
end
private
- def issue_or_pr_summary(type, type_label)
- oldest_date_format = "%b %e, %Y"
- a = analysis
+ def issue_or_pr_summary(type, type_label)
+ oldest_date_format = "%b %e, %Y"
+ a = analysis
- number_of_type = a.send("number_of_#{type}s")
+ number_of_type = a.send("number_of_#{type}s")
- "There are #{number_of_type} #{type_label}s open. " +
- "The average #{type_label} age is #{a.send("average_#{type}_age")}, and the " +
- "oldest was opened on #{a.send("oldest_#{type}_date").strftime(oldest_date_format)}."
- end
+ type_link = a.send("#{type}s_url")
+ oldest = a.send("oldest_#{type}")
+
+ "There are #{link("#{number_of_type} #{type_label}s open", type_link)}. " +
+ "The average #{type_label} age is #{a.send("average_#{type}_age")}, and the " +
+ "#{link("oldest", oldest['html_url'])} was opened on #{oldest['date'].strftime(oldest_date_format)}."
+ end
end
class Report
require 'how_is/report/pdf'
require 'how_is/report/json'
@@ -43,11 +46,14 @@
header "Issues"
text issue_or_pr_summary "issue", "issue"
header "Issues Per Label"
- issues_per_label = analysis.issues_with_label.to_a.sort_by { |(k, v)| v.to_i }.reverse
- issues_per_label << ["(No label)", analysis.issues_with_no_label]
+ issues_per_label = analysis.issues_with_label.to_a.sort_by { |(k, v)| v['total'].to_i }.reverse
+ issues_per_label.map! do |label, hash|
+ [label, hash['total'], hash['link']]
+ end
+ issues_per_label << ["(No label)", analysis.issues_with_no_label['total'], nil]
horizontal_bar_graph issues_per_label
end
def self.export!(analysis, file)
format = file.split('.').last