From c5d935108e7280959d82ff0ebb98df661821d278 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 20 Jan 2016 15:59:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E8=AF=BE=E7=A8=8B=E6=8C=89ta?= =?UTF-8?q?g=E6=90=9C=E7=B4=A2=E6=8E=A8=E8=8D=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 6d16dbb4a..13d8e99b6 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -25,9 +25,8 @@ module CoursesHelper # 获取tag匹配结果ID a_tags = [] # kc = keywords.to_a - Course.visible.where("is_excellent =?", 2).each do |ec| + Course.visible.where("is_excellent =?", 1).each do |ec| if ec.tags.any?{|value| current_course.name.include?(value.to_s)} - #if ec.tags.find_all{|ect| kc.include? ect}.length != 0 a_tags << ec.id end end @@ -42,7 +41,7 @@ module CoursesHelper end a_courses << a_tags unless a_tags.length == 0 # 过滤条件:精品课程、本身不在搜索范围 - e_courses = Course.where("is_excellent =? and id in (?)",1,a_courses.uniq).where("id !=?",current_course.id) + e_courses = Course.where("is_excellent =? and id in (?)",1,a_courses.flatten.uniq).where("id !=?",current_course.id) e_courses end