From 8b672cc7c3ee4868cbbcb0bd5e72517c748bc5dc Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 3 May 2016 17:57:24 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E3=80=81=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/news_controller.rb | 2 ++ app/controllers/users_controller.rb | 6 +++--- app/views/users/_user_course_list.html.erb | 1 + app/views/users/_user_project_list.html.erb | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) 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 %>资源
<%= 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 @@