项目列表根据ID排序
This commit is contained in:
parent
d48a733502
commit
749b9c4429
|
@ -34,7 +34,7 @@ class AdminController < ApplicationController
|
|||
def projects
|
||||
@status = params[:status] || 1
|
||||
|
||||
scope = Project.status(@status).order('lft')
|
||||
scope = Project.status(@status).order('id asc')
|
||||
scope = scope.like(params[:name]) if params[:name].present?
|
||||
@projects = scope.where(project_type: Project::ProjectType_project).all
|
||||
|
||||
|
|
|
@ -839,7 +839,7 @@ class Project < ActiveRecord::Base
|
|||
# Yields the given block for each project with its level in the tree
|
||||
def self.project_tree(projects, &block)
|
||||
ancestors = []
|
||||
projects.sort_by(&:lft).each do |project|
|
||||
projects.sort_by(&:id).each do |project|
|
||||
while (ancestors.any? && !project.is_descendant_of?(ancestors.last))
|
||||
ancestors.pop
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue