Browse Source

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

pull/348/head^2^2
yystopf 1 year ago
parent
commit
afc87f1393
2 changed files with 10 additions and 4 deletions
  1. +7
    -1
      app/controllers/api/pm/weekly_issues_controller.rb
  2. +3
    -3
      app/services/api/pm/issues/create_service.rb

+ 7
- 1
app/controllers/api/pm/weekly_issues_controller.rb View File

@@ -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


+ 3
- 3
app/services/api/pm/issues/create_service.rb View File

@@ -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


Loading…
Cancel
Save