|
|
|
@@ -1,4 +1,5 @@ |
|
|
|
class ProjectCategoriesController < ApplicationController |
|
|
|
before_action :re_total_count, only: [:pinned_index] |
|
|
|
def index |
|
|
|
# @project_categories = ProjectCategory.search(params[:name]).without_content |
|
|
|
q = ProjectCategory.ransack(name_cont: params[:name]) |
|
|
|
@@ -14,4 +15,11 @@ class ProjectCategoriesController < ApplicationController |
|
|
|
# projects = Project.no_anomory_projects.visible |
|
|
|
# @category_group_list = projects.joins(:project_category).group("project_categories.id", "project_categories.name").size |
|
|
|
end |
|
|
|
|
|
|
|
def re_total_count |
|
|
|
# 未分类项目与其他放在一起 |
|
|
|
other_category = ProjectCategory.find_by(name: "其它") |
|
|
|
other_count = Project.where(project_category_id: [15,nil]).count |
|
|
|
other_category.update(projects_count: other_count) |
|
|
|
end |
|
|
|
end |