fixed 查询sql性能优化

This commit is contained in:
xxq250 2025-09-29 16:29:16 +08:00
parent 29cde8621c
commit d5cf6e444d
1 changed files with 1 additions and 1 deletions

View File

@ -21,7 +21,7 @@ class Api::Pm::DashboardsController < Api::Pm::BaseController
@all_issues = Issue.where(pm_project_id: pm_project_ids, pm_issue_type: pm_issue_types).order(created_on: :desc)
@issues = @all_issues.joins(:issue_participants).where(issue_participants: {participant_id: current_user.id, participant_type: 'assigned'})
@issues = @issues.where.not(status_id: 5) if params[:category] == "opened"
@issues = @issues.where.where("issues.id > 0")
@issues = @issues.where("issues.id > 0")
@issues = kaminari_paginate(@issues.distinct.pm_includes)
@my_assign_requirements_count = @all_issues.where(pm_issue_type: 1).joins(:issue_participants).where(issue_participants: {participant_id: current_user.id, participant_type: 'assigned'}).size
@my_assign_tasks_count = @all_issues.where(pm_issue_type: 2).joins(:issue_participants).where(issue_participants: {participant_id: current_user.id, participant_type: 'assigned'}).size