some more replacement of deprecated finders

pull/6827/head
Jens Ulferts 9 years ago
parent 3df6036399
commit c518fb76b7
  1. 2
      app/helpers/rb_common_helper.rb
  2. 2
      app/models/story.rb
  3. 2
      app/models/task.rb
  4. 2
      lib/open_project/backlogs/patches/work_package_patch.rb

@ -217,7 +217,7 @@ module RbCommonHelper
end
def all_work_package_status
@all_work_package_status ||= Status.all(order: 'position ASC')
@all_work_package_status ||= Status.order('position ASC')
end
def backlogs_types

@ -40,7 +40,7 @@ class Story < WorkPackage
options.reverse_merge!(order: Story::ORDER,
conditions: Story.condition(project_id, sprint_ids))
candidates = Story.all(options)
candidates = Story.where(options[:conditions]).order(options[:order])
stories_by_version = Hash.new do |hash, sprint_id|
hash[sprint_id] = []

@ -99,7 +99,7 @@ class Task < WorkPackage
end
def rank
@rank ||= WorkPackage.count(conditions: ['type_id = ? and not parent_id is NULL and root_id = ? and lft <= ?', Task.type, story_id, lft])
@rank ||= WorkPackage.where(['type_id = ? and not parent_id is NULL and root_id = ? and lft <= ?', Task.type, story_id, lft]).count
@rank
end
end

@ -212,7 +212,7 @@ module OpenProject::Backlogs::Patches::WorkPackagePatch
real_parent = WorkPackage.find_by_id(parent_id)
# Sort immediate ancestors first
ancestors = ([real_parent] + real_parent.ancestors.all(include: { project: :enabled_modules })).sort_by(&:right)
ancestors = [real_parent] + real_parent.ancestors.includes(project: :enabled_modules).order(:rgt)
end
ancestors
end

Loading…
Cancel
Save