From b036d5b63daf595113067bb385596a735fae88b9 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 13 Aug 2015 11:08:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E7=AB=99=E9=A6=96=E9=A1=B5=E3=80=81?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5=E3=80=81=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E3=80=81=E8=AF=BE=E7=A8=8B=E7=AD=89=E9=A1=B5=E9=9D=A2header?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE/=E8=AF=BE=E7=A8=8B=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A1=86=E6=8C=89=E7=85=A7=E6=9C=80=E6=96=B0=E7=9A=84=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- app/views/layouts/_base_header.html.erb | 2 +- app/views/layouts/_base_header_new.html.erb | 10 +++++++--- app/views/layouts/_new_header.html.erb | 4 ++-- app/views/layouts/_user_courses_list.html.erb | 2 +- app/views/layouts/_user_project_list.html.erb | 2 +- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d82db77b2..9b9bf5f76 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1812,7 +1812,7 @@ module ApplicationHelper #获取用户未过期的课程 def get_user_course user courses_doing = [] - user.courses.each do |course| + user.courses.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").each do |course| if !course_endTime_timeout?(course) courses_doing.push course end diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index 49c8b5499..c6ba7cf10 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -18,7 +18,7 @@