From d6c3c5665806309d88603709fd38c2d30d034258 Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 30 Oct 2025 15:06:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E7=BC=A9=E7=9F=AD?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admins/dashboards_controller.rb | 18 +++++++++--------- app/models/journal.rb | 18 +++++++++--------- app/views/admins/dashboards/index.html.erb | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/controllers/admins/dashboards_controller.rb b/app/controllers/admins/dashboards_controller.rb index ca2529297..9c4a19015 100644 --- a/app/controllers/admins/dashboards_controller.rb +++ b/app/controllers/admins/dashboards_controller.rb @@ -43,34 +43,34 @@ class Admins::DashboardsController < Admins::BaseController # 总的平台项目数 # 总的平台组织数 # 总的平台Issue数、评论数、PR数、Commit数 - @user_count = Rails.cache.fetch("dashboardscontroller:platform:user_count", expires_in: 1.days) do + @user_count = Rails.cache.fetch("dashboardscontroller:platform:user_count", expires_in: 1.hours) do User.count end - @project_count = Rails.cache.fetch("dashboardscontroller:platform:project_count", expires_in: 1.days) do + @project_count = Rails.cache.fetch("dashboardscontroller:platform:project_count", expires_in: 1.hours) do Project.count end - @organization_count = Rails.cache.fetch("dashboardscontroller:platform:organization_count", expires_in: 1.days) do + @organization_count = Rails.cache.fetch("dashboardscontroller:platform:organization_count", expires_in: 1.hours) do Organization.count end - @issue_count = Rails.cache.fetch("dashboardscontroller:platform:issue_count", expires_in: 1.days) do + @issue_count = Rails.cache.fetch("dashboardscontroller:platform:issue_count", expires_in: 1.hours) do Issue.count end - @comment_count = Rails.cache.fetch("dashboardscontroller:platform:comment_count", expires_in: 1.days) do + @comment_count = Rails.cache.fetch("dashboardscontroller:platform:comment_count", expires_in: 1.hours) do Journal.count end - @pr_count = Rails.cache.fetch("dashboardscontroller:platform:pr_count", expires_in: 1.days) do + @pr_count = Rails.cache.fetch("dashboardscontroller:platform:pr_count", expires_in: 1.hours) do PullRequest.count end - @commit_count = Rails.cache.fetch("dashboardscontroller:platform:commit_count", expires_in: 1.days) do + @commit_count = Rails.cache.fetch("dashboardscontroller:platform:commit_count", expires_in: 1.hours) do CommitLog.count end - @maven_count = Rails.cache.fetch("dashboardscontroller:platform:maven_count", expires_in: 1.days) do + @maven_count = Rails.cache.fetch("dashboardscontroller:platform:maven_count", expires_in: 1.hours) do result = ActiveRecord::Base.connection.select_all("SELECT * FROM pm_nexus_statistics where format ='maven' order by id desc limit 1") result.rows[0][2] end - @pypi_count = Rails.cache.fetch("dashboardscontroller:platform:pypi_count", expires_in: 1.days) do + @pypi_count = Rails.cache.fetch("dashboardscontroller:platform:pypi_count", expires_in: 1.hours) do result = ActiveRecord::Base.connection.select_all("SELECT * FROM pm_nexus_statistics where format ='pypi' order by id desc limit 1") result.rows[0][2] end diff --git a/app/models/journal.rb b/app/models/journal.rb index 6a018cfce..19b6d30db 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -402,9 +402,9 @@ class Journal < ApplicationRecord new_value = "未设置" if detail.value.blank? content += "将工作项类型由#{old_value}更改为#{new_value}" end - content.gsub!('1', '需求') - content.gsub!('2', '任务') - content.gsub!('3', '缺陷') + content.gsub!('1', '需求') + content.gsub!('2', '任务') + content.gsub!('3', '缺陷') return content when 'pm_sprint_id' old_value = detail.old_value @@ -538,9 +538,9 @@ class Journal < ApplicationRecord content += "新建了关联的工作项#{new_value}" end end - content.gsub!('1', "需求") - content.gsub!('2', "任务") - content.gsub!('3', "缺陷") + content.gsub!('[1]-', "[需求]-") + content.gsub!('[2]-', "[任务]-") + content.gsub!('[3]-', "[缺陷]-") return content when 'tag_link_issue' old_value = Issue.where(id: detail.old_value.to_s.split(",")).map{|i| "[#{i.pm_issue_type}]-<#{i.subject}>"}.join("、") @@ -554,9 +554,9 @@ class Journal < ApplicationRecord content += "关联了工作项#{new_value}" end end - content.gsub!('1', "需求") - content.gsub!('2', "任务") - content.gsub!('3', "缺陷") + content.gsub!('[1]-', "[需求]-") + content.gsub!('[2]-', "[任务]-") + content.gsub!('[3]-', "[缺陷]-") return content when 'issue' issue = self.issue diff --git a/app/views/admins/dashboards/index.html.erb b/app/views/admins/dashboards/index.html.erb index a55ef55e4..3bcc2e985 100644 --- a/app/views/admins/dashboards/index.html.erb +++ b/app/views/admins/dashboards/index.html.erb @@ -2,7 +2,7 @@ <% add_admin_breadcrumb('概览', admins_path) %> <% end %> -<% cache "/admin/dashboards/#{Time.now.strftime('%Y-%m-%d')}", :expires_in => 1.days do %> +<% cache "/admin/dashboards/#{Time.now.strftime('%Y-%m-%d')}", :expires_in => 1.hours do %>