lib/how_is/analyzer.rb in how_is-1.0.0 vs lib/how_is/analyzer.rb in how_is-2.0.0
- old
+ new
@@ -78,14 +78,13 @@
def num_with_no_label(issues)
issues.select { |x| x['labels'].empty? }.length
end
def average_date_for(issues_or_pulls)
- timestamps = issues_or_pulls.map { |iop| Time.parse(iop['created_at']).to_i }
+ timestamps = issues_or_pulls.map { |iop| Date.parse(iop['created_at']).strftime('%s').to_i }
average_timestamp = timestamps.reduce(:+) / issues_or_pulls.length
- average_time = Time.at(average_timestamp)
- Date.parse(average_time.to_s)
+ Date.strptime(average_timestamp.to_s, '%s')
end
# Given an Array of issues or pulls, return the average age of them.
def average_age_for(issues_or_pulls)
ages = issues_or_pulls.map {|iop| time_ago_in_seconds(iop['created_at'])}