using strings instead of symbols

This commit is contained in:
Andrew Waage
2016-05-19 23:55:16 -07:00
committed by Olle Jonsson
parent 3cb3584bb9
commit ca5d6d9675
3 changed files with 15 additions and 15 deletions

View File

@@ -49,12 +49,12 @@ module GitHubChangelogGenerator
# Fill :actual_date parameter of specified issue by closed date of the commit, if it was closed by commit.
# @param [Hash] issue
def find_closed_date_by_commit(issue)
unless issue[:events].nil?
unless issue['events'].nil?
# if it's PR -> then find "merged event", in case of usual issue -> fond closed date
compare_string = issue[:merged_at].nil? ? "closed" : "merged"
compare_string = issue['merged_at'].nil? ? "closed" : "merged"
# reverse! - to find latest closed event. (event goes in date order)
issue[:events].reverse!.each do |event|
if event[:event].eql? compare_string
issue['events'].reverse!.each do |event|
if event['event'].eql? compare_string
set_date_from_event(event, issue)
break
end
@@ -68,16 +68,16 @@ module GitHubChangelogGenerator
# @param [Hash] event
# @param [Hash] issue
def set_date_from_event(event, issue)
if event[:commit_id].nil?
issue[:actual_date] = issue[:closed_at]
if event['commit_id'].nil?
issue['actual_date'] = issue['closed_at']
else
begin
commit = @fetcher.fetch_commit(event)
issue[:actual_date] = commit[:commit][:author][:date]
# issue[:actual_date] = commit[:author][:date]
issue['actual_date'] = commit['commit']['author']['date']
# issue['actual_date'] = commit['author']['date']
rescue
puts "Warning: Can't fetch commit #{event[:commit_id]}. It is probably referenced from another repo."
issue[:actual_date] = issue[:closed_at]
puts "Warning: Can't fetch commit #{event['commit_id']}. It is probably referenced from another repo."
issue['actual_date'] = issue['closed_at']
end
end
end