Merge branch 'pre_trustie_server' into trustie_server

This commit is contained in:
xxq250 2023-03-07 16:40:03 +08:00
commit 2e223ccd6e
1 changed files with 6 additions and 5 deletions

View File

@ -39,13 +39,14 @@ class ProjectsController < ApplicationController
category_id = params[:category_id]
@total_count =
if category_id.blank?
# ps = ProjectStatistic.first
# ps.common_projects_count + ps.mirror_projects_count unless ps.blank?
if category_id.blank? && params[:search].blank?
# 默认查询时count性能问题处理
ProjectCategory.sum("projects_count") - Project.visible.joins("left join organization_extensions on organization_extensions.organization_id = projects.user_id").where("organization_extensions.visibility =2").count
elsif params[:search].present?
@projects.total_count
else
cate = ProjectCategory.find_by(id: category_id)
cate&.projects_count || 0
cate = ProjectCategory.find_by(id: category_id)
cate&.projects_count || 0
end
end