mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-22 12:45:46 +08:00
新增:项目缓存加入关闭issue数量
This commit is contained in:
@@ -99,9 +99,20 @@ 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
|
||||
after_save :change_versions_count, :send_update_message_to_notice_system, :associate_attachment_container
|
||||
after_save :incre_or_decre_closed_issues_count, :change_versions_count, :send_update_message_to_notice_system, :associate_attachment_container
|
||||
after_destroy :update_closed_issues_count_in_project!, :decre_project_common, :decre_user_statistic, :decre_platform_statistic
|
||||
|
||||
def incre_or_decre_closed_issues_count
|
||||
if previous_changes[:status_id].present?
|
||||
if previous_changes[:status_id][1] == 5
|
||||
CacheAsyncSetJob.perform_later("project_common_service", {closed_issues: 1}, self.project_id)
|
||||
end
|
||||
if previous_changes[:status_id][0] == 5
|
||||
CacheAsyncSetJob.perform_later("project_common_service", {closed_issues: -1}, self.project_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def incre_project_common
|
||||
CacheAsyncSetJob.perform_later("project_common_service", {issues: 1}, self.project_id)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user