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 @@