@ -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')
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
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
@ -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)
ancestors