我的课程/我的项目按照课程/项目最新动态的时间排序
This commit is contained in:
parent
b036d5b63d
commit
29092db557
|
@ -118,7 +118,7 @@ class UsersController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
projects = @user.projects.visible.order("updated_on desc")
|
projects = @user.projects.visible.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc")
|
||||||
if(params[:status] == '1')
|
if(params[:status] == '1')
|
||||||
projects = projects.where("projects.user_id = ?",@user.id)
|
projects = projects.where("projects.user_id = ?",@user.id)
|
||||||
elsif(params[:status] == '2')
|
elsif(params[:status] == '2')
|
||||||
|
@ -248,7 +248,7 @@ class UsersController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
courses = @user.courses.visible.order("created_at desc")
|
courses = @user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc")
|
||||||
if(params[:status] == '1')
|
if(params[:status] == '1')
|
||||||
courses = courses.where("endup_time >= ? or endup_time is null or endup_time=''",Time.now)
|
courses = courses.where("endup_time >= ? or endup_time is null or endup_time=''",Time.now)
|
||||||
elsif(params[:status] == '2')
|
elsif(params[:status] == '2')
|
||||||
|
|
Loading…
Reference in New Issue