fixed some handling of hashes

This commit is contained in:
Andrew Waage 2016-05-23 16:30:17 -07:00 committed by Olle Jonsson
parent aee2f43235
commit 3179f29a7c
2 changed files with 9 additions and 8 deletions

View File

@ -119,8 +119,9 @@ module GitHubChangelogGenerator
#
# @return [Array] filtered issues and pull requests
def filter_issues_for_tags(newer_tag, older_tag)
filtered_pull_requests = delete_by_time(@pull_requests, :actual_date, older_tag, newer_tag)
filtered_issues = delete_by_time(@issues, :actual_date, older_tag, newer_tag)
filtered_pull_requests = delete_by_time(@pull_requests, 'actual_date', older_tag, newer_tag)
filtered_issues = delete_by_time(@issues, 'actual_date', older_tag, newer_tag)
newer_tag_name = newer_tag.nil? ? nil : newer_tag["name"]

View File

@ -32,18 +32,18 @@ module GitHubChangelogGenerator
# @return [Array] issues with milestone #tag_name
def find_issues_to_add(all_issues, tag_name)
all_issues.select do |issue|
if issue.milestone.nil?
if issue['milestone'].nil?
false
else
# check, that this milestone in tag list:
milestone_is_tag = @filtered_tags.find do |tag|
tag.name == issue.milestone.title
tag['name'] == issue['milestone']['title']
end
if milestone_is_tag.nil?
false
else
issue.milestone.title == tag_name
issue['milestone']['title'] == tag_name
end
end
end
@ -53,11 +53,11 @@ module GitHubChangelogGenerator
def remove_issues_in_milestones(filtered_issues)
filtered_issues.select! do |issue|
# leave issues without milestones
if issue.milestone.nil?
if issue['milestone'].nil?
true
else
# check, that this milestone in tag list:
@filtered_tags.find { |tag| tag.name == issue.milestone.title }.nil?
@filtered_tags.find { |tag| tag['name'] == issue['milestone']['title'] }.nil?
end
end
end
@ -68,7 +68,7 @@ module GitHubChangelogGenerator
# @param [String] older_tag all issues before this tag date will be excluded. May be nil, if it's first tag
# @param [String] newer_tag all issue after this tag will be excluded. May be nil for unreleased section
# @return [Array] filtered issues
def delete_by_time(issues, hash_key = :actual_date, older_tag = nil, newer_tag = nil)
def delete_by_time(issues, hash_key = 'actual_date', older_tag = nil, newer_tag = nil)
# in case if not tags specified - return unchanged array
return issues if older_tag.nil? && newer_tag.nil?