diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 51eb759e1..76b229dbf 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -103,7 +103,8 @@ class NewsController < ApplicationController end scope_order.each do |topic| - topic[:updated_at] = CourseActivity.where("course_act_type='#{topic.class}' and course_act_id =#{topic.id}").first.updated_at + topic[:updated_at] = topic.course_acts.first.updated_at + #topic[:updated_at] = CourseActivity.where("course_act_type='#{topic.class}' and course_act_id =#{topic.id}").first.updated_at end #根据 赞+回复数排序 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index f67289a4b..6cc94d5a7 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2858,7 +2858,9 @@ class UsersController < ApplicationController 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}") + @courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*").order("#{sort_name} #{sort_type}") + + # @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}") #根据 作业+资源数排序 if @order.to_i == 2 @@ -2902,7 +2904,8 @@ class UsersController < ApplicationController sort_name = "updated_on" sort_type = @c_sort == 1 ? "asc" : "desc" - @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}") + @projects = @user.projects.visible.select("projects.*").order("#{sort_name} #{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/forums/_show_topics.html.erb b/app/views/forums/_show_topics.html.erb index 93df27e42..08c030f90 100644 --- a/app/views/forums/_show_topics.html.erb +++ b/app/views/forums/_show_topics.html.erb @@ -29,7 +29,9 @@
<% end %> - +<%= l(:label_no_data) %>
<% end %> diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index b0ed5a60c..2b3772734 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -41,9 +41,6 @@