directly loads all tasks that are children of a given story when querying for tasks_for

* speeds up query
pull/6827/head
Jens Ulferts 12 years ago
parent e238fc1660
commit 4274692e25
  1. 11
      app/models/task.rb

@ -31,14 +31,9 @@ class Task < Issue
end
def self.tasks_for(story_id)
tasks = []
Story.find_by_id(story_id).children.
find_all_by_tracker_id(Task.tracker, :order => :lft).each_with_index {|task, i|
task = Task.find(task.id)
task.rank = i + 1
tasks << task
}
return tasks
Task.find_all_by_parent_id(story_id, :order => :lft).each_with_index do |task, i|
task.rank = i + 1
end
end
def status_id=(id)

Loading…
Cancel
Save