更改:个人周报新增分页以及项目组周报创建和个人周报创建一致

This commit is contained in:
yystopf 2025-05-26 09:08:29 +08:00
parent d91b7da82c
commit afc87f1393
2 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,4 @@
class Api::Pm::WeeklyIssuesController < ApplicationController class Api::Pm::WeeklyIssuesController < Api::Pm::BaseController
def personal def personal
@enterprise_identifier = params[:enterprise_identifier] || '' @enterprise_identifier = params[:enterprise_identifier] || ''
@ -15,6 +15,12 @@ class Api::Pm::WeeklyIssuesController < ApplicationController
@close_requirement_issues = @this_week_requirement_issues.where(status_id: [3,5]) @close_requirement_issues = @this_week_requirement_issues.where(status_id: [3,5])
@close_task_issues = @this_week_task_issues.where(status_id: [3,5]) @close_task_issues = @this_week_task_issues.where(status_id: [3,5])
@close_bug_issues = @this_week_bug_issues.where(status_id: [3,5]) @close_bug_issues = @this_week_bug_issues.where(status_id: [3,5])
this_week_page = params[:this_week_page] || 1
this_week_limit = params[:this_week_limit] || 15
@this_week_all_issues = @this_week_all_issues.page(this_week_page).per(this_week_limit)
next_week_page = params[:next_week_page] || 1
next_week_limit = params[:next_week_limit] || 15
@next_week_all_issues = @next_week_all_issues.page(next_week_page).per(next_week_limit)
end end
def group def group

View File

@ -57,10 +57,10 @@ class Api::Pm::Issues::CreateService < ApplicationService
try_lock("Api::Pm::Issues::CreateService:#{project.id}") # 开始写数据,加锁 try_lock("Api::Pm::Issues::CreateService:#{project.id}") # 开始写数据,加锁
@created_issue = Issue.new(issue_attributes) @created_issue = Issue.new(issue_attributes)
@created_issue.pm_issue_type = @pm_issue_type @created_issue.pm_issue_type = @pm_issue_type
if @root_subject.present? && @pm_issue_type.to_i == 4 if @root_subject.present? && [4, 5].include?(@pm_issue_type.to_i)
@root_issue = Issue.find_by(subject: @root_subject, pm_issue_type: 4, pm_project_id: @pm_project_id,enterprise_identifier: @enterprise_identifier) @root_issue = Issue.find_by(subject: @root_subject, pm_issue_type: @pm_issue_type.to_i, pm_project_id: @pm_project_id,enterprise_identifier: @enterprise_identifier)
unless @root_issue.present? unless @root_issue.present?
@root_issue = Issue.create(subject: @root_subject, pm_issue_type: 4, pm_project_id: @pm_project_id, enterprise_identifier: @enterprise_identifier, status_id: 1, priority_id: 1, tracker_id: Tracker.first.id, project_id: @project.id, author_id: current_user.id) @root_issue = Issue.create(subject: @root_subject, pm_issue_type: @pm_issue_type.to_i, pm_project_id: @pm_project_id, enterprise_identifier: @enterprise_identifier, status_id: 1, priority_id: 1, tracker_id: Tracker.first.id, project_id: @project.id, author_id: current_user.id)
end end
@created_issue.root_id = @root_issue.id @created_issue.root_id = @root_issue.id
else else