From fee7cc4b2c8c853b23fea4dd41717f59feb1308d Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 3 Mar 2016 18:10:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=8E=A8=E8=8D=90=E4=B8=AD?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=A7=81=E6=9C=89=E8=AF=BE=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 2cdb277be..8db852abd 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -25,7 +25,7 @@ module CoursesHelper # 获取tag匹配结果ID a_tags = [] # kc = keywords.to_a - Course.visible.where("is_excellent =?", 1).each do |ec| + Course.visible.where("is_excellent =? and is_public =?", 1, 1).each do |ec| if ec.tags.any?{|value| current_course.name.include?(value.to_s)} a_tags << ec.id end @@ -44,7 +44,7 @@ module CoursesHelper excellent_ids = a_courses.flatten.uniq.delete_if{|i| i == current_course.id} limit = 5 - excellent_ids.length.to_i sql = "SELECT distinct c.id FROM course_activities cs, courses c where cs.course_id = c.id - and c.is_excellent =1 and c.id != #{current_course.id} order by cs.updated_at desc;" + and c.is_excellent =1 and c.is_public = 1 and c.id != #{current_course.id} order by cs.updated_at desc;" default_ecourse_ids = Course.find_by_sql(sql).flatten # REDO:时间紧,待优化 default_ids =[]