Skip to content

Commit

Permalink
Fixed error produced when reporting on certain failed issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo Hourvitz committed Jan 6, 2012
1 parent 37fc628 commit 975739b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/controllers/importer_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 80,7 @@ def match

# Returns the issue object associated with the given value of the given attribute.
# Raises NoIssueForUniqueValue if not found or MultipleIssuesForUniqueValue
def issue_for_unique_attr(unique_attr, attr_value)
def issue_for_unique_attr(unique_attr, attr_value, row_data)
if @issue_by_unique_attr.has_key?(attr_value)
return @issue_by_unique_attr[attr_value]
end
Expand All @@ -97,7 97,7 @@ def issue_for_unique_attr(unique_attr, attr_value)
if issues.size > 1
flash[:warning] = "Unique field #{unique_attr} with value '#{attr_value}' has duplicate record"
@failed_count = 1
@failed_issues[@handle_count 1] = row
@failed_issues[@handle_count 1] = row_data
raise MultipleIssuesForUniqueValue, "Unique field #{unique_attr} with value '#{attr_value}' has duplicate record"
else
if issues.size == 0
Expand Down Expand Up @@ -213,7 213,7 @@ def result

if update_issue
begin
issue = issue_for_unique_attr(unique_attr,row[unique_field])
issue = issue_for_unique_attr(unique_attr,row[unique_field],row)

# ignore other project's issue or not
if issue.project_id != @project.id && !update_other_project
Expand Down Expand Up @@ -272,7 272,7 @@ def result
# parent issues
begin
if row[attrs_map["parent_issue"]] != nil
issue.parent_issue_id = issue_for_unique_attr(unique_attr,row[attrs_map["parent_issue"]]).id
issue.parent_issue_id = issue_for_unique_attr(unique_attr,row[attrs_map["parent_issue"]],row).id
end
rescue NoIssueForUniqueValue
if ignore_non_exist
Expand Down Expand Up @@ -332,7 332,7 @@ def result
if !row[attrs_map[rtype]]
next
end
other_issue = issue_for_unique_attr(unique_attr,row[attrs_map[rtype]])
other_issue = issue_for_unique_attr(unique_attr,row[attrs_map[rtype]],row)
relations = issue.relations.select { |r| (r.other_issue(issue).id == other_issue.id) && (r.relation_type_for(issue) == rtype) }
if relations.length == 0
relation = IssueRelation.new( :issue_from => issue, :issue_to => other_issue, :relation_type => rtype )
Expand Down

0 comments on commit 975739b

Please sign in to comment.