From 23a4a29c768222320887ab3db8fc89d27c12c94e Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 7 Apr 2016 14:12:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E8=81=94=E9=A1=B9=E7=9B=AE=E3=80=81?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=B8=AD=E8=BF=87=E6=BB=A4=E6=8E=89=E7=A7=81?= =?UTF-8?q?=E6=9C=89=E8=AF=BE=E7=A8=8B=E3=80=81=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index ab97b5b1b..4fa7659c9 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -352,7 +352,7 @@ class OrganizationsController < ApplicationController if !params[:name].nil? condition = "%#{params[:name].strip}%".gsub(" ","") end - sql = "select courses.* from courses inner join members on courses.id = members.course_id where members.user_id = #{User.current.id} and courses.name like '#{condition}'"+ + sql = "select courses.* from courses inner join members on courses.id = members.course_id where members.user_id = #{User.current.id} and courses.is_public = 1 and courses.name like '#{condition}'"+ "and courses.id not in (select distinct org_courses.course_id from org_courses where org_courses.organization_id = #{@organization.id}) and courses.is_delete=0" #user_courses = Course.find_by_sql(sql) @courses = Course.find_by_sql(sql) @@ -396,7 +396,7 @@ class OrganizationsController < ApplicationController if !params[:name].nil? condition = "%#{params[:name].strip}%".gsub(" ","") end - sql = "select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.name like '#{condition}'" + + sql = "select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.is_public = 1 and projects.name like '#{condition}'" + " and projects.id not in (select org_projects.project_id from org_projects where organization_id = #{@organization.id}) and status=1" #user_projects = Course.find_by_sql(sql) @projects = Course.find_by_sql(sql)