Merge pull request '新增 pm issue 变更为关闭时,结束时间为空则自动添加结束时间' (#267) from KingChan/forgeplus:pm_project_develop into pm_project_develop

This commit is contained in:
KingChan 2024-01-31 09:11:50 +08:00
commit 413b90199d
2 changed files with 8 additions and 1 deletions

View File

@ -182,7 +182,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController
def batch_issue_params
params.permit(
:status_id, :priority_id, :milestone_id, :pm_sprint_id, :pm_issue_type, :root_id, :target_pm_project_id, :project_id,
:status_id, :priority_id, :milestone_id, :pm_sprint_id, :due_date, :pm_issue_type, :root_id, :target_pm_project_id, :project_id,
:issue_tag_ids => [],
:assigner_ids => [] )
end

View File

@ -104,9 +104,16 @@ class Issue < ApplicationRecord
scope :closed, ->{where(status_id: 5)}
scope :opened, ->{where.not(status_id: 5)}
after_create :incre_project_common, :incre_user_statistic, :incre_platform_statistic
before_save :check_pm_and_update_due_date
after_save :change_versions_count, :send_update_message_to_notice_system, :associate_attachment_container, :generate_uuid
after_destroy :update_closed_issues_count_in_project!, :decre_project_common, :decre_user_statistic, :decre_platform_statistic
def check_pm_and_update_due_date
if pm_project_id.present? && status_id.changed? && status_id == 5
self.due_date = self.due_date || Time.current
end
end
def incre_project_common
CacheAsyncSetJob.perform_later('project_common_service', {issues: 1}, self.project_id)
end