|
|
|
@@ -126,12 +126,12 @@ func getRepoKPIStats(repoPath string, wikiPath string) (*git.RepoKPIStats, error |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func GetTop10Contributor(repoPath string) ([]ContributorWithUserId, error) { |
|
|
|
func GetTop10Contributor(repoPath string) ([]*ContributorWithUserId, error) { |
|
|
|
contributors, err := git.GetContributors(repoPath) |
|
|
|
if err != nil { |
|
|
|
return make([]ContributorWithUserId, 0), err |
|
|
|
return make([]*ContributorWithUserId, 0), err |
|
|
|
} |
|
|
|
contributorDistinctDict := make(map[string]ContributorWithUserId, 0) |
|
|
|
contributorDistinctDict := make(map[string]*ContributorWithUserId, 0) |
|
|
|
if contributors != nil { |
|
|
|
for _, contributor := range contributors { |
|
|
|
if strings.Compare(contributor.Email, "") == 0 { |
|
|
|
@@ -143,7 +143,7 @@ func GetTop10Contributor(repoPath string) ([]ContributorWithUserId, error) { |
|
|
|
|
|
|
|
value, ok := contributorDistinctDict[user.Email] |
|
|
|
if !ok { |
|
|
|
contributorDistinctDict[user.Email] = ContributorWithUserId{ |
|
|
|
contributorDistinctDict[user.Email] = &ContributorWithUserId{ |
|
|
|
git.Contributor{ |
|
|
|
contributor.CommitCnt, |
|
|
|
user.Name, |
|
|
|
@@ -161,7 +161,7 @@ func GetTop10Contributor(repoPath string) ([]ContributorWithUserId, error) { |
|
|
|
} else { |
|
|
|
value, ok := contributorDistinctDict[contributor.Email] |
|
|
|
if !ok { |
|
|
|
contributorDistinctDict[contributor.Email] = ContributorWithUserId{ |
|
|
|
contributorDistinctDict[contributor.Email] = &ContributorWithUserId{ |
|
|
|
contributor, |
|
|
|
-1, |
|
|
|
false, |
|
|
|
@@ -174,7 +174,7 @@ func GetTop10Contributor(repoPath string) ([]ContributorWithUserId, error) { |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
v := make([]ContributorWithUserId, 0, len(contributorDistinctDict)) |
|
|
|
v := make([]*ContributorWithUserId, 0, len(contributorDistinctDict)) |
|
|
|
for _, value := range contributorDistinctDict { |
|
|
|
v = append(v, value) |
|
|
|
} |
|
|
|
@@ -189,7 +189,7 @@ func GetTop10Contributor(repoPath string) ([]ContributorWithUserId, error) { |
|
|
|
return v[0:10], nil |
|
|
|
} |
|
|
|
} |
|
|
|
return make([]ContributorWithUserId, 0), nil |
|
|
|
return make([]*ContributorWithUserId, 0), nil |
|
|
|
} |
|
|
|
|
|
|
|
func setKeyContributerDict(contributorDistinctDict map[string]int, email string, keyContributorsDict map[string]struct{}) { |
|
|
|
|