diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index f16dbd97f..7c60e2dc3 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -32,7 +32,7 @@ class WelcomeController < ApplicationController def course if params[:school_id] @school_id = params[:school_id] - else + elsif User.current.logged? && User.current.user_extensions.school @school_id = User.current.user_extensions.school.id end @logoLink ||= logolink() diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 0054b003f..1004a49ad 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -233,8 +233,13 @@ module WelcomeHelper def find_all_new_hot_course limit = 9 ,school_id = 0 #sort_project_by_hot_rails 1, 'course_ac_para DESC', limit time_now = Time.new.strftime("%Y"); + if school_id courses = Course.visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id <> ?", school_id).order("course_ac_para DESC").limit(limit).all + else + courses = Course.visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id is not NULL + ").order("course_ac_para DESC").limit(limit).all + end courses end diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index 9a25d9dbf..e79cc12cf 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -3,26 +3,25 @@