mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-20 19:55:56 +08:00
Merge branch 'hh_portrait' into standalone_develop
This commit is contained in:
@@ -56,6 +56,11 @@ class Cache::V2::PlatformStatisticService < ApplicationService
|
||||
"max-issue-count"
|
||||
end
|
||||
|
||||
# 平台最高已解决issue数
|
||||
def max_complete_issue_count_key
|
||||
"max-complete-issue-count"
|
||||
end
|
||||
|
||||
# 平台最高commit数
|
||||
def max_commit_count_key
|
||||
"max-commit-count"
|
||||
@@ -86,6 +91,11 @@ class Cache::V2::PlatformStatisticService < ApplicationService
|
||||
"max-recent-one-month-commit-count"
|
||||
end
|
||||
|
||||
# 平台近一个月release最大值
|
||||
def max_recent_one_month_release_count_key
|
||||
"max-recent-one-month-release-count"
|
||||
end
|
||||
|
||||
def follow_count_key
|
||||
"follow-count"
|
||||
end
|
||||
@@ -216,6 +226,11 @@ class Cache::V2::PlatformStatisticService < ApplicationService
|
||||
$redis_cache.hset(platform_statistic_key, max_issue_count_key, max_issue[1].nil? ? 0 : max_issue[1])
|
||||
end
|
||||
|
||||
def reset_platform_max_complete_issue_count
|
||||
max_complete_issue = Issue.where.not(project_id: 0).issue_issue.where(status_id: [3,5]).group(:project_id).count.sort_by{|i|i[1]}.last || []
|
||||
$redis_cache.hset(platform_statistic_key, max_complete_issue_count_key, max_complete_issue[1].nil? ? 0 : max_complete_issue[1])
|
||||
end
|
||||
|
||||
def reset_platform_max_commit_count
|
||||
max_commit = CommitLog.joins(:project).merge(Project.common).group(:project_id).count.sort_by{|i|i[1]}.last || []
|
||||
$redis_cache.hset(platform_statistic_key, max_commit_count_key, max_commit[1].nil? ? 0 : max_commit[1])
|
||||
@@ -237,7 +252,7 @@ class Cache::V2::PlatformStatisticService < ApplicationService
|
||||
end
|
||||
|
||||
def reset_platform_max_recent_one_month_issue_count
|
||||
max_recent_one_month_issue = Issue.issue_issue.where("created_on > ?", Time.now - 30.days).group(:project_id).count.sort_by{|i|i[1]}.last || []
|
||||
max_recent_one_month_issue = Issue.where.not(project_id: 0).issue_issue.where("created_on > ?", Time.now - 30.days).group(:project_id).count.sort_by{|i|i[1]}.last || []
|
||||
$redis_cache.hset(platform_statistic_key, max_recent_one_month_issue_count_key, max_recent_one_month_issue[1].nil? ? 0 : max_recent_one_month_issue[1])
|
||||
end
|
||||
|
||||
@@ -246,6 +261,11 @@ class Cache::V2::PlatformStatisticService < ApplicationService
|
||||
$redis_cache.hset(platform_statistic_key, max_recent_one_month_commit_count_key, max_recent_one_month_commit[1].nil? ? 0 : max_recent_one_month_commit[1])
|
||||
end
|
||||
|
||||
def reset_platform_max_recent_one_month_release_count
|
||||
max_recent_one_month_release = VersionRelease.where("created_at >?", Time.now - 30.days).group(:repository_id).count.sort_by{|i|i[1]}.last || []
|
||||
$redis_cache.hset(platform_statistic_key, max_recent_one_month_release_count_key, max_recent_one_month_release[1].nil? ? 0 : max_recent_one_month_release[1])
|
||||
end
|
||||
|
||||
def reset_platform_follow_count
|
||||
$redis_cache.hset(platform_statistic_key, follow_count_key, Watcher.where(watchable_type: 'User').count)
|
||||
end
|
||||
@@ -255,7 +275,7 @@ class Cache::V2::PlatformStatisticService < ApplicationService
|
||||
end
|
||||
|
||||
def reset_platform_issue_count
|
||||
$redis_cache.hset(platform_statistic_key, issue_count_key, Issue.count)
|
||||
$redis_cache.hset(platform_statistic_key, issue_count_key, Issue.where.not(project_id: 0).count)
|
||||
end
|
||||
|
||||
def reset_platform_project_count
|
||||
@@ -299,6 +319,8 @@ class Cache::V2::PlatformStatisticService < ApplicationService
|
||||
reset_platform_max_recent_one_month_pullrequest_count
|
||||
reset_platform_max_recent_one_month_issue_count
|
||||
reset_platform_max_recent_one_month_commit_count
|
||||
reset_platform_max_recent_one_month_release_count
|
||||
reset_platform_max_complete_issue_count
|
||||
|
||||
$redis_cache.hgetall(platform_statistic_key)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user