更改:团队影响度团队人数

This commit is contained in:
yystopf 2025-05-29 20:22:47 +08:00
parent 7067c7d190
commit eb1b917d98
2 changed files with 4 additions and 3 deletions

View File

@ -130,8 +130,8 @@ class Api::V1::Projects::PortraitController < Api::V1::BaseController
has_license = @project.license.present? ? 1 : 0
closed_pullrequest_count = PullRequest.where(project_id: @project.id).merged_and_closed.count
closed_issue_count = Issue.issue_issue.where(project_id: @project.id).closed.count
closed_pullrequest_count = PullRequest.where(project_id: @project.id, status: 1).count
closed_issue_count = Issue.issue_issue.where(project_id: @project.id, status_id: [3,5]).count
pullrequest_count = PullRequest.where(project_id: @project.id).count
issue_count = Issue.issue_issue.where(project_id: @project.id).count
health_code1 = max_member_count.to_i == 0 ? 0 : 0.3*(member_count.to_f/max_member_count)
@ -161,6 +161,7 @@ class Api::V1::Projects::PortraitController < Api::V1::BaseController
recent_one_month_member_count = Member.where(project_id:@project.id).where("created_on >?", Time.now - 30.days).count
max_recent_one_month_member_count = @platform_statistic['max-recent-one-month-member-count'].to_i
issue_assigner_count = IssueAssigner.joins(:issue).merge(Issue.issue_issue).where(issues: {project_id: @project.id}).distinct.count
project_member_count = @project.owner.is_a?(User) ? member_count : @project.owner.organization_users.count
team_impact_member = 40*(member_count.to_f/max_member_count)
team_impact_recent_member = 40*(recent_one_month_member_count.to_f/max_recent_one_month_member_count)
team_impact_issue_assigner = 20*(issue_assigner_count.to_f/max_member_count)

View File

@ -252,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