|
|
@@ -100,8 +100,11 @@ class Project < ApplicationRecord |
|
|
end
|
|
|
end
|
|
|
|
|
|
|
|
|
def self.list_user_projects(user_id)
|
|
|
def self.list_user_projects(user_id)
|
|
|
user_not_show = Project.joins(:members).where("projects.is_public = ? and projects.user_id != ? and members.user_id != ?", false, user_id,user_id).pluck(:id).uniq
|
|
|
|
|
|
Project.where.not(id: user_not_show)
|
|
|
|
|
|
|
|
|
projects = Project.is_private.select(:id)
|
|
|
|
|
|
user_not_show_1 = projects.where(user_id: user_id).pluck(:id).uniq
|
|
|
|
|
|
|
|
|
|
|
|
user_show_2 = projects.joins(:members).where("members.user_id = ?", user_id).pluck(:id).uniq
|
|
|
|
|
|
Project.where.not(id: (user_not_show_1 - user_show_2.uniq))
|
|
|
end
|
|
|
end
|
|
|
|
|
|
|
|
|
end
|
|
|
end
|