# File app/models/task.rb, line 49 def self.find_started if current_user user_clause = " OR user_id = #{current_user.id}" end conditions = "completed_at IS NULL AND (user_id IS NULL#{user_clause})" Work.find(:all, :conditions => conditions).map {|work| work.task}.sort do |t1, t2| if (backlog_sort = t1.backlog.name <=> t2.backlog.name) != 0 backlog_sort elsif (period_sort = t1.period.end_on <=> t2.period.end_on) != 0 period_sort else t1.position <=> t2.position end end end