Check inclusion only once (#14015).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11832 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-05-12 08:45:40 +00:00
parent a7102db8c4
commit 922acdbcc2
1 changed files with 10 additions and 6 deletions

View File

@ -904,13 +904,15 @@ class Issue < ActiveRecord::Base
# the children of the current node need to be processed. # the children of the current node need to be processed.
if current_issue.children && (current_issue_status == ePROCESS_CHILDREN_ONLY || current_issue_status == ePROCESS_ALL) if current_issue.children && (current_issue_status == ePROCESS_CHILDREN_ONLY || current_issue_status == ePROCESS_ALL)
current_issue.children.each do |child| current_issue.children.each do |child|
if (issue_status[child] == eNOT_DISCOVERED) && !except.include?(child) next if except.include?(child)
if (issue_status[child] == eNOT_DISCOVERED)
queue << child queue << child
issue_status[child] = ePROCESS_ALL issue_status[child] = ePROCESS_ALL
elsif (issue_status[child] == eRELATIONS_PROCESSED) && !except.include?(child) elsif (issue_status[child] == eRELATIONS_PROCESSED)
queue << child queue << child
issue_status[child] = ePROCESS_CHILDREN_ONLY issue_status[child] = ePROCESS_CHILDREN_ONLY
elsif (issue_status[child] == ePROCESS_RELATIONS_ONLY) && !except.include?(child) elsif (issue_status[child] == ePROCESS_RELATIONS_ONLY)
queue << child queue << child
issue_status[child] = ePROCESS_ALL issue_status[child] = ePROCESS_ALL
end end
@ -919,13 +921,15 @@ class Issue < ActiveRecord::Base
# Add related issues to the queue, if they are not already in it. # Add related issues to the queue, if they are not already in it.
current_issue.relations_from.map(&:issue_to).each do |related_issue| current_issue.relations_from.map(&:issue_to).each do |related_issue|
if (issue_status[related_issue] == eNOT_DISCOVERED) && !except.include?(related_issue) next if except.include?(related_issue)
if (issue_status[related_issue] == eNOT_DISCOVERED)
queue << related_issue queue << related_issue
issue_status[related_issue] = ePROCESS_ALL issue_status[related_issue] = ePROCESS_ALL
elsif (issue_status[related_issue] == eRELATIONS_PROCESSED) && !except.include?(related_issue) elsif (issue_status[related_issue] == eRELATIONS_PROCESSED)
queue << related_issue queue << related_issue
issue_status[related_issue] = ePROCESS_CHILDREN_ONLY issue_status[related_issue] = ePROCESS_CHILDREN_ONLY
elsif (issue_status[related_issue] == ePROCESS_RELATIONS_ONLY) && !except.include?(related_issue) elsif (issue_status[related_issue] == ePROCESS_RELATIONS_ONLY)
queue << related_issue queue << related_issue
issue_status[related_issue] = ePROCESS_ALL issue_status[related_issue] = ePROCESS_ALL
end end