From f468f0cf672b8946386d60cdd13501cb5e4b4d94 Mon Sep 17 00:00:00 2001 From: yystopf Date: Wed, 17 Jan 2024 17:39:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E7=BB=9F=E8=AE=A1is?= =?UTF-8?q?sue=E6=95=B0=E9=87=8F=E4=B8=8D=E5=BA=94=E8=AF=A5=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1pr=E5=85=B3=E8=81=94=E7=9A=84issue=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/issue.rb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index b580d6994..6904aaf46 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -102,8 +102,12 @@ class Issue < ApplicationRecord 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 is_issuely_issue? + self.issue_classify.nil? || self.issue_classify == 'issue' + end + def incre_or_decre_closed_issues_count - if previous_changes[:status_id].present? + if previous_changes[:status_id].present? && is_issuely_issue if previous_changes[:status_id][1] == 5 CacheAsyncSetJob.perform_later("project_common_service", {closed_issues: 1}, self.project_id) end @@ -114,27 +118,27 @@ class Issue < ApplicationRecord end def incre_project_common - CacheAsyncSetJob.perform_later("project_common_service", {issues: 1}, self.project_id) + CacheAsyncSetJob.perform_later("project_common_service", {issues: 1}, self.project_id) if is_issuely_issue end def decre_project_common - CacheAsyncSetJob.perform_later("project_common_service", {issues: -1}, self.project_id) + CacheAsyncSetJob.perform_later("project_common_service", {issues: -1}, self.project_id) if is_issuely_issue end def incre_user_statistic - CacheAsyncSetJob.perform_later("user_statistic_service", {issue_count: 1}, self.author_id) + CacheAsyncSetJob.perform_later("user_statistic_service", {issue_count: 1}, self.author_id) if is_issuely_issue end def decre_user_statistic - CacheAsyncSetJob.perform_later("user_statistic_service", {issue_count: -1}, self.author_id) + CacheAsyncSetJob.perform_later("user_statistic_service", {issue_count: -1}, self.author_id) if is_issuely_issue end def incre_platform_statistic - CacheAsyncSetJob.perform_later("platform_statistic_service", {issue_count: 1}) + CacheAsyncSetJob.perform_later("platform_statistic_service", {issue_count: 1}) if is_issuely_issue end def decre_platform_statistic - CacheAsyncSetJob.perform_later("platform_statistic_service", {issue_count: -1}) + CacheAsyncSetJob.perform_later("platform_statistic_service", {issue_count: -1}) if is_issuely_issue end def get_assign_user