优化课程首页效率
This commit is contained in:
parent
f7635370d7
commit
33855f721d
|
@ -233,10 +233,10 @@ module WelcomeHelper
|
|||
#sort_project_by_hot_rails 1, 'course_ac_para DESC', limit
|
||||
time_now = Time.new.strftime("%Y")
|
||||
if school_id
|
||||
courses = Course.includes(:school).visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id <>
|
||||
courses = Course.includes(:school, :members).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.includes(:school).visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id is not NULL
|
||||
courses = Course.includes(:school, :members).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
|
||||
|
|
Loading…
Reference in New Issue