This commit is contained in:
呱呱呱 2024-01-31 09:08:38 +08:00
parent 9b9374c99b
commit 65d2387931
1 changed files with 7 additions and 0 deletions

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