项目按更新时间倒排
This commit is contained in:
parent
8de307d198
commit
4411136cb4
|
@ -104,13 +104,20 @@ class UsersController < ApplicationController
|
|||
|
||||
#added by young
|
||||
def user_projects
|
||||
|
||||
if User.current.admin?
|
||||
@memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}")
|
||||
else
|
||||
cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
|
||||
@memberships = @user.memberships.all(:conditions => cond)
|
||||
end
|
||||
@memberships = @memberships.sort {|a,b| b.created_on.to_i <=> a.created_on.to_i}
|
||||
# unless @memberships.nil?
|
||||
# @user_projects = []
|
||||
# @memberships.each do |membership|
|
||||
# @user_projects << membership.project
|
||||
# end
|
||||
# @user_projects = @user_projects.sort {|a,b| b.created_on.to_i <=> a.created_on.to_i}
|
||||
# end
|
||||
#events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20)
|
||||
#@events_by_day = events.group_by(&:event_date)
|
||||
@state = 0
|
||||
|
@ -256,9 +263,7 @@ class UsersController < ApplicationController
|
|||
|
||||
membership.sort! {|older, newer| newer.created_on <=> older.created_on }
|
||||
@memberships = []
|
||||
membership.collect { |e|
|
||||
@memberships.push(e)
|
||||
}
|
||||
membership.collect { |e| @memberships.push(e)}
|
||||
## 判断课程是否过期 [需封装]
|
||||
@memberships_doing = []
|
||||
@memberships_done = []
|
||||
|
|
Loading…
Reference in New Issue