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 %> - + <% else %>

<%= 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 @@
<%= render :partial => 'show_topics',:locals => {:memos=>@memos}%>
- diff --git a/app/views/forums/show.js.erb b/app/views/forums/show.js.erb index 9e36215ac..48b1474cb 100644 --- a/app/views/forums/show.js.erb +++ b/app/views/forums/show.js.erb @@ -1,2 +1 @@ $("#topics_list").html("<%= escape_javascript(render :partial => 'show_topics',:locals => {:memos=>@memos})%>") -$("#pages").html('<%= pagination_links_full @topic_pages, @topic_count,:per_page_links => false,:remote =>true%>'); \ No newline at end of file diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index 65ea3770d..e43aa499f 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -346,28 +346,30 @@