remove trailing white-spaces from app/models/workflow.rb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6879 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
03cfa5c7a2
commit
dd03483c65
|
@ -1,16 +1,16 @@
|
|||
# redMine - project management software
|
||||
# Copyright (C) 2006 Jean-Philippe Lang
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
@ -21,13 +21,13 @@ class Workflow < ActiveRecord::Base
|
|||
belongs_to :new_status, :class_name => 'IssueStatus', :foreign_key => 'new_status_id'
|
||||
|
||||
validates_presence_of :role, :old_status, :new_status
|
||||
|
||||
|
||||
# Returns workflow transitions count by tracker and role
|
||||
def self.count_by_tracker_and_role
|
||||
counts = connection.select_all("SELECT role_id, tracker_id, count(id) AS c FROM #{Workflow.table_name} GROUP BY role_id, tracker_id")
|
||||
roles = Role.find(:all, :order => 'builtin, position')
|
||||
trackers = Tracker.find(:all, :order => 'position')
|
||||
|
||||
|
||||
result = []
|
||||
trackers.each do |tracker|
|
||||
t = []
|
||||
|
@ -37,7 +37,7 @@ class Workflow < ActiveRecord::Base
|
|||
end
|
||||
result << [tracker, t]
|
||||
end
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -51,19 +51,19 @@ class Workflow < ActiveRecord::Base
|
|||
uniq.
|
||||
sort
|
||||
end
|
||||
|
||||
|
||||
# Copies workflows from source to targets
|
||||
def self.copy(source_tracker, source_role, target_trackers, target_roles)
|
||||
unless source_tracker.is_a?(Tracker) || source_role.is_a?(Role)
|
||||
raise ArgumentError.new("source_tracker or source_role must be specified")
|
||||
end
|
||||
|
||||
|
||||
target_trackers = [target_trackers].flatten.compact
|
||||
target_roles = [target_roles].flatten.compact
|
||||
|
||||
|
||||
target_trackers = Tracker.all if target_trackers.empty?
|
||||
target_roles = Role.all if target_roles.empty?
|
||||
|
||||
|
||||
target_trackers.each do |target_tracker|
|
||||
target_roles.each do |target_role|
|
||||
copy_one(source_tracker || target_tracker,
|
||||
|
@ -73,17 +73,17 @@ class Workflow < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Copies a single set of workflows from source to target
|
||||
def self.copy_one(source_tracker, source_role, target_tracker, target_role)
|
||||
unless source_tracker.is_a?(Tracker) && !source_tracker.new_record? &&
|
||||
source_role.is_a?(Role) && !source_role.new_record? &&
|
||||
target_tracker.is_a?(Tracker) && !target_tracker.new_record? &&
|
||||
target_role.is_a?(Role) && !target_role.new_record?
|
||||
|
||||
|
||||
raise ArgumentError.new("arguments can not be nil or unsaved objects")
|
||||
end
|
||||
|
||||
|
||||
if source_tracker == target_tracker && source_role == target_role
|
||||
false
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue