issues_count增加我负责的统计

This commit is contained in:
xxq250 2024-01-26 15:38:32 +08:00
parent 088bb3d1ac
commit 28de064841
1 changed files with 10 additions and 0 deletions

View File

@ -13,6 +13,16 @@ class Api::Pm::ProjectsController < Api::Pm::BaseController
def issues_count
return tip_exception '参数错误' unless params[:pm_project_id].present?
@issues = Issue.where(pm_project_id: params[:pm_project_id])
case params[:participant_category].to_s
when 'aboutme' # 关于我的
@issues = @issues.joins(:issue_participants).where(issue_participants: {participant_type: %w[authored assigned atme], participant_id: current_user&.id})
when 'authoredme' # 我创建的
@issues = @issues.joins(:issue_participants).where(issue_participants: {participant_type: 'authored', participant_id: current_user&.id})
when 'assignedme' # 我负责的
@issues = @issues.joins(:issue_participants).where(issue_participants: {participant_type: 'assigned', participant_id: current_user&.id})
when 'atme' # @我的
@issues = @issues.joins(:issue_participants).where(issue_participants: {participant_type: 'atme', participant_id: current_user&.id})
end
data = {}
@issues_count = @issues.group(:pm_project_id).count
# requirement 1 task 2 bug 3