From 0eacd9acda65d59aa0f05abb4bbc4c03d564cc47 Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Tue, 17 Feb 2015 23:09:07 +0200 Subject: [PATCH] put in actual date right closed date --- lib/github_changelog_generator.rb | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/github_changelog_generator.rb b/lib/github_changelog_generator.rb index d9ddeba..87c150f 100755 --- a/lib/github_changelog_generator.rb +++ b/lib/github_changelog_generator.rb @@ -59,13 +59,24 @@ module GitHubChangelogGenerator end def find_closed_date_by_commit(issue) + closed_date = nil puts issue[:number] unless issue['events'].nil? - issue['events'].each{|event| - puts event[:event] + # reverse! - to find latest closed event. (event goes in date order) + issue['events'].reverse!.each{|event| + if event[:event].eql? 'closed' + if event[:commit_id].nil? + issue[:actual_date] = issue[:closed_at] + else + commit = @github.git_data.commits.get @options[:user], @options[:project], event[:commit_id] + issue[:actual_date] = commit[:author][:date] + end + + break + end } end - 0 + closed_date end def print_json(json)