diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index d35d7ac63..51eb759e1 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -83,6 +83,8 @@ class NewsController < ApplicationController sort_type = @b_sort == 1 ? "asc" : "desc" + #scope = News.find_by_sql("select a.*,b.updated_at from news a, course_activities b where a.course_id = 532 and a.course_id = b.course_id and b.course_act_id = a.id ) ") + scope = @course ? @course.news.course_visible : News.course_visible news_arr = scope.map{|news| news.id} diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c4b1b244e..f67289a4b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2855,7 +2855,7 @@ class UsersController < ApplicationController @c_sort = 2 end - sort_name = "created_at" + sort_name = "updated_at" sort_type = @c_sort == 1 ? "asc" : "desc" @courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a #{sort_type}") @@ -2899,10 +2899,10 @@ class UsersController < ApplicationController @c_sort = 2 end - sort_name = "created_on" + sort_name = "updated_on" sort_type = @c_sort == 1 ? "asc" : "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 #{sort_type}") + @projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a #{sort_type}") #根据 问题+资源数排序 @project.project_score.issue_num @project.project_score.attach_num if @order.to_i == 2 diff --git a/app/views/users/_user_course_list.html.erb b/app/views/users/_user_course_list.html.erb index ca9420f7d..2fbf8e6ce 100644 --- a/app/views/users/_user_course_list.html.erb +++ b/app/views/users/_user_course_list.html.erb @@ -30,6 +30,7 @@ 创建时间:<%= format_time(course.created_at) %> + 更新时间:<%= format_time(course.updated_at) %> 开课学期: <%= current_time_and_term course %> diff --git a/app/views/users/_user_project_list.html.erb b/app/views/users/_user_project_list.html.erb index 11f2981b0..fbc02c848 100644 --- a/app/views/users/_user_project_list.html.erb +++ b/app/views/users/_user_project_list.html.erb @@ -27,6 +27,7 @@
<%= project.project_score.issue_num %>问题| <%= project.project_score.attach_num %>资源