|
|
|
@@ -898,13 +898,24 @@ func Forks(ctx *context.Context) { |
|
|
|
} |
|
|
|
|
|
|
|
func Contributors(ctx *context.Context) { |
|
|
|
page := ctx.QueryInt("page") |
|
|
|
if page <= 0 { |
|
|
|
page = 1 |
|
|
|
} |
|
|
|
pageSize := setting.UI.ContributorPagingNum |
|
|
|
start := (page-1) * pageSize |
|
|
|
end := page * pageSize |
|
|
|
count := 0 |
|
|
|
//get repo contributors info |
|
|
|
contributors, err := git.GetContributors(ctx.Repo.Repository.RepoPath()) |
|
|
|
if err == nil && contributors != nil { |
|
|
|
startTime := time.Now() |
|
|
|
var contributorInfos []*ContributorInfo |
|
|
|
contributorInfoHash := make(map[string]*ContributorInfo) |
|
|
|
for _, c := range contributors { |
|
|
|
for i, c := range contributors { |
|
|
|
if i < start || i >= end { |
|
|
|
continue |
|
|
|
} |
|
|
|
if strings.Compare(c.Email, "") == 0 { |
|
|
|
continue |
|
|
|
} |
|
|
|
@@ -937,9 +948,17 @@ func Contributors(ctx *context.Context) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
count ++ |
|
|
|
ctx.Data["ContributorInfo"] = contributorInfos |
|
|
|
var duration= time.Since(startTime) |
|
|
|
log.Info("getContributorInfo cost: %v seconds", duration.Seconds()) |
|
|
|
} else { |
|
|
|
ctx.ServerError("GetContributors failed", err) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
pager := context.NewPagination(count, pageSize, page, 5) |
|
|
|
ctx.Data["Page"] = pager |
|
|
|
ctx.Data["Total"] = count |
|
|
|
ctx.HTML(http.StatusOK, tplContributors) |
|
|
|
} |