[FIX]project category not include private repo

This commit is contained in:
vilet.yy 2021-02-26 16:20:26 +08:00
parent b5870b1020
commit ce105b4c07
2 changed files with 5 additions and 2 deletions

View File

@ -6,6 +6,8 @@ class ProjectCategoriesController < ApplicationController
end end
def group_list def group_list
@project_categories = ProjectCategory.where('projects_count > 0').order(projects_count: :desc) # @project_categories = ProjectCategory.where('projects_count > 0').order(projects_count: :desc)
@project_categories = ProjectCategory.eager_load(:projects)
.where(projects: {is_public: true})
end end
end end

View File

@ -1,5 +1,6 @@
json.array! @project_categories do |category| json.array! @project_categories do |category|
json.id category.id json.id category.id
json.name category.name json.name category.name
json.projects_count category.projects_count # json.projects_count category.projects_count
json.projects_count category.projects.size
end end