更改:团队影响度团队人数
This commit is contained in:
		
							parent
							
								
									7067c7d190
								
							
						
					
					
						commit
						eb1b917d98
					
				| 
						 | 
					@ -130,8 +130,8 @@ class Api::V1::Projects::PortraitController < Api::V1::BaseController
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    has_license = @project.license.present? ? 1 : 0
 | 
					    has_license = @project.license.present? ? 1 : 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    closed_pullrequest_count = PullRequest.where(project_id: @project.id).merged_and_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).closed.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
 | 
					    pullrequest_count = PullRequest.where(project_id: @project.id).count
 | 
				
			||||||
    issue_count = Issue.issue_issue.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)
 | 
					    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
 | 
					    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
 | 
					    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
 | 
					    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_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_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)
 | 
					    team_impact_issue_assigner = 20*(issue_assigner_count.to_f/max_member_count)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -252,7 +252,7 @@ class Cache::V2::PlatformStatisticService < ApplicationService
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def reset_platform_max_recent_one_month_issue_count
 | 
					  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])
 | 
					    $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
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue