发送至搜索课程问题

dev_forum
daiao 5 years ago
parent e1c40cd30d
commit 21c0d774e4

@ -674,14 +674,14 @@ class ShixunsController < ApplicationController
limit = params[:limit] || 20 limit = params[:limit] || 20
if params[:search] if params[:search]
search = "%#{params[:search].to_s.strip.downcase}%" search = "%#{params[:search].to_s.strip.downcase}%"
course_ids = Course.find_by_sql("SELECT c.id FROM courses c, members m, member_roles mr course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m
WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) WHERE m.course_id = c.id AND m.role in (1,2,3)
AND m.user_id=#{current_user.id} AND c.is_delete = 0 AND c.is_end = 0 AND m.user_id=#{current_user.id} AND c.is_delete = 0 AND c.is_end = 0
AND c.name like '#{search}' ").map(&:id) AND c.name like '#{search}' ").map(&:id)
else else
course_ids = Course.find_by_sql("SELECT c.id, c.name FROM courses c, members m, member_roles mr course_ids = Course.find_by_sql("SELECT c.id, c.name FROM courses c, course_members m
WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) WHERE m.course_id = c.id AND m.role in (1,2,3)
AND m.user_id=#{current_user.id} AND c.is_delete = 0 AND c.is_end = 0").map(&:id) AND m.user_id=#{current_user.id} AND c.is_delete = 0 AND c.is_end = 0").map(&:id)
end end

Loading…
Cancel
Save