From c927bb6fd67521f54ecc957452856308a7930e05 Mon Sep 17 00:00:00 2001 From: nwb Date: Sat, 5 Jul 2014 09:33:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E8=AF=BE=E7=A8=8B=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/welcome_helper.rb | 9 ++++----- app/views/welcome/course.html.erb | 4 +++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 1004a49a..4ff5a48e 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -141,27 +141,26 @@ module WelcomeHelper Course.active.visible. joins(:memberships). group('members.course_id'). - reorder("courses.time DESC, COUNT(members.course_id) DESC").take sum - + reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum else if school_id.nil? Course.active.visible. joins(:memberships). where("#{Course.table_name}.school_id = ?", User.current.user_extensions.school.id). group('members.course_id'). - reorder("courses.time DESC, COUNT(members.course_id) DESC").take sum + reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum else if school_id == "0" Course.active.visible. joins(:memberships). group('members.course_id'). - reorder("courses.time DESC, COUNT(members.course_id) DESC").take sum + reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum else Course.active.visible. joins(:memberships). where("#{Course.table_name}.school_id = ?", school_id). group('members.course_id'). - reorder("courses.time DESC, COUNT(members.course_id) DESC").take sum + reorder("courses.created_at DESC, COUNT(members.course_id) DESC").take sum end end end diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index e79cc12c..624bd01d 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -73,7 +73,7 @@

新开课程

<% if @school_id %> - <% school_course = find_miracle_course(10, 7, @school_id) %> + <% school_course = find_miracle_course(10,7, @school_id) %> <% else %> <%school_course=[]%> <% end %> @@ -138,6 +138,7 @@