code cleanup: rubocop: fix Style/WhileUntilModifier in app/models/project.rb

git-svn-id: http://svn.redmine.org/redmine/trunk@18758 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA
2019-10-19 11:15:43 +00:00
parent 0ea9e05b68
commit 0fdaa963aa
2 changed files with 2 additions and 2 deletions

View File

@@ -1446,7 +1446,6 @@ Style/VariableInterpolation:
Style/WhileUntilModifier: Style/WhileUntilModifier:
Exclude: Exclude:
- 'app/models/attachment.rb' - 'app/models/attachment.rb'
- 'app/models/project.rb'
- 'lib/redmine/unified_diff.rb' - 'lib/redmine/unified_diff.rb'
- 'lib/redmine/utils.rb' - 'lib/redmine/utils.rb'

View File

@@ -868,7 +868,8 @@ class Project < ActiveRecord::Base
ancestors = projects.first.ancestors.to_a ancestors = projects.first.ancestors.to_a
end end
projects.sort_by(&:lft).each do |project| projects.sort_by(&:lft).each do |project|
while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) while (ancestors.any? &&
!project.is_descendant_of?(ancestors.last))
ancestors.pop ancestors.pop
end end
yield project, ancestors.size yield project, ancestors.size