forked from Gitlink/forgeplus
修改搜索显示数量不对的问题
This commit is contained in:
parent
611aafdb4f
commit
2b24bc9724
|
@ -15,8 +15,8 @@ class ProjectCategoriesController < ApplicationController
|
|||
if current_user&.logged?
|
||||
projects = Project.list_user_projects(current_user.id)
|
||||
else
|
||||
projects = Project.no_anomory_projects.visible
|
||||
projects = Project.visible
|
||||
end
|
||||
@category_group_list = projects.joins(:project_category).group("project_categories.id", "project_categories.name").size
|
||||
@category_group_list = projects.no_anomory_projects.joins(:project_category).group("project_categories.id", "project_categories.name").size
|
||||
end
|
||||
end
|
||||
|
|
|
@ -51,10 +51,10 @@ class ProjectsController < ApplicationController
|
|||
if current_user&.logged?
|
||||
projects = Project.list_user_projects(current_user.id)
|
||||
else
|
||||
projects = Project.no_anomory_projects.visible
|
||||
projects = Project.visible
|
||||
end
|
||||
# projects = Project.visible
|
||||
@project_group_list = projects.group(:project_type).size
|
||||
@project_group_list = projects.no_anomory_projects.group(:project_type).size
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
|
@ -105,7 +105,7 @@ class Project < ApplicationRecord
|
|||
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.no_anomory_projects.where.not(id: (user_not_show_1 - user_show_2).uniq)
|
||||
Project.where.not(id: (user_not_show_1 - user_show_2).uniq)
|
||||
end
|
||||
|
||||
def members_count
|
||||
|
|
|
@ -21,9 +21,9 @@ class Projects::ListQuery < ApplicationQuery
|
|||
if params[:user_id].to_i != 2 && params[:user_id].to_i != 0
|
||||
projects = Project.list_user_projects(params[:user_id])
|
||||
else
|
||||
projects = Project.no_anomory_projects.visible #匿名用户的项目
|
||||
projects = Project.visible #匿名用户的项目
|
||||
end
|
||||
scope = projects.includes(:project_category, :project_language, :repository, owner: :user_extension).like(params[:search])
|
||||
scope = projects.no_anomory_projects.includes(:project_category, :project_language, :repository, owner: :user_extension).like(params[:search])
|
||||
.with_project_type(params[:project_type])
|
||||
.with_project_category(params[:category_id])
|
||||
.with_project_language(params[:language_id])
|
||||
|
|
Loading…
Reference in New Issue