From afc87f1393e2d851bea37224ccfe43fd4b717621 Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 26 May 2025 09:08:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E5=91=A8=E6=8A=A5=E6=96=B0=E5=A2=9E=E5=88=86=E9=A1=B5=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E9=A1=B9=E7=9B=AE=E7=BB=84=E5=91=A8=E6=8A=A5=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E5=92=8C=E4=B8=AA=E4=BA=BA=E5=91=A8=E6=8A=A5=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/pm/weekly_issues_controller.rb | 8 +++++++- app/services/api/pm/issues/create_service.rb | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/pm/weekly_issues_controller.rb b/app/controllers/api/pm/weekly_issues_controller.rb index 261c6218d..4ef402b79 100644 --- a/app/controllers/api/pm/weekly_issues_controller.rb +++ b/app/controllers/api/pm/weekly_issues_controller.rb @@ -1,4 +1,4 @@ -class Api::Pm::WeeklyIssuesController < ApplicationController +class Api::Pm::WeeklyIssuesController < Api::Pm::BaseController def personal @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_task_issues = @this_week_task_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 def group diff --git a/app/services/api/pm/issues/create_service.rb b/app/services/api/pm/issues/create_service.rb index caaee3892..ac0e33c0a 100644 --- a/app/services/api/pm/issues/create_service.rb +++ b/app/services/api/pm/issues/create_service.rb @@ -57,10 +57,10 @@ class Api::Pm::Issues::CreateService < ApplicationService try_lock("Api::Pm::Issues::CreateService:#{project.id}") # 开始写数据,加锁 @created_issue = Issue.new(issue_attributes) @created_issue.pm_issue_type = @pm_issue_type - if @root_subject.present? && @pm_issue_type.to_i == 4 - @root_issue = Issue.find_by(subject: @root_subject, pm_issue_type: 4, pm_project_id: @pm_project_id,enterprise_identifier: @enterprise_identifier) + if @root_subject.present? && [4, 5].include?(@pm_issue_type.to_i) + @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? - @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 @created_issue.root_id = @root_issue.id else