Merge branch 'pre_trustie_server' into trustie_server

This commit is contained in:
yystopf 2024-01-17 17:53:48 +08:00
commit 7d6e09c696
2 changed files with 12 additions and 8 deletions

View File

@ -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_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 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 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 if previous_changes[:status_id][1] == 5
CacheAsyncSetJob.perform_later("project_common_service", {closed_issues: 1}, self.project_id) CacheAsyncSetJob.perform_later("project_common_service", {closed_issues: 1}, self.project_id)
end end
@ -114,27 +118,27 @@ class Issue < ApplicationRecord
end end
def incre_project_common 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 end
def decre_project_common 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 end
def incre_user_statistic 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 end
def decre_user_statistic 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 end
def incre_platform_statistic 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 end
def decre_platform_statistic 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 end
def get_assign_user def get_assign_user

View File

@ -1,5 +1,5 @@
<% define_admin_breadcrumbs do %> <% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('项目排行榜', admins_path) %> <% add_admin_breadcrumb('疑修排行榜', admins_path) %>
<% end %> <% end %>