Module: RedmineVersionPriorities::Patches::VersionPatch::ClassMethods
- Defined in:
- lib/redmine_version_priorities/patches/version_patch.rb
Instance Method Summary collapse
Instance Method Details
#reprioritize(order) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/redmine_version_priorities/patches/version_patch.rb', line 27 def reprioritize(order) ordered_ids = order.collect(&:to_i) if order.present? ordered_ids ||= [] # Removed versions Version.visible.prioritized.each do |version| unless ordered_ids.include?(version.id) version.remove_from_list end end # Sort ordered_ids.each_with_index do |version_id, index| version = Version.find_by_id(version_id) version.insert_at( index + 1) if version end end |