forked from Trustie/forgeplus
更改:缩短缓存时间
This commit is contained in:
parent
9551b5a462
commit
d6c3c56658
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -402,9 +402,9 @@ class Journal < ApplicationRecord
|
|||
new_value = "未设置" if detail.value.blank?
|
||||
content += "将工作项类型由<b>#{old_value}</b>更改为<b>#{new_value}</b>"
|
||||
end
|
||||
content.gsub!('1', '需求')
|
||||
content.gsub!('2', '任务')
|
||||
content.gsub!('3', '缺陷')
|
||||
content.gsub!('<b>1</b>', '<b>需求</b>')
|
||||
content.gsub!('<b>2</b>', '<b>任务</b>')
|
||||
content.gsub!('<b>3</b>', '<b>缺陷</b>')
|
||||
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| "<b>[#{i.pm_issue_type}]-<#{i.subject}></b>"}.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
|
||||
|
|
|
|||
|
|
@ -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 %>
|
||||
<div class="header bg-gradient-primary pb-8 pt-md-8">
|
||||
<div class="container-fluid">
|
||||
<div class="header-body">
|
||||
|
|
|
|||
Loading…
Reference in New Issue