diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 39a467d53..410bd44e1 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -118,7 +118,7 @@ class UsersController < ApplicationController return 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') projects = projects.where("projects.user_id = ?",@user.id) elsif(params[:status] == '2') @@ -248,7 +248,7 @@ class UsersController < ApplicationController return 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') courses = courses.where("endup_time >= ? or endup_time is null or endup_time=''",Time.now) elsif(params[:status] == '2')