From 664fd0329b9d3ded6f54cb5f07f6cde846ac597c Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Thu, 11 Nov 2021 18:55:02 +0800 Subject: [PATCH] sort --- routers/repo/view.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routers/repo/view.go b/routers/repo/view.go index cd59ec920..8b9039087 100755 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -15,6 +15,7 @@ import ( "net/http" "net/url" "path" + "sort" "strings" "time" @@ -964,6 +965,9 @@ func ContributorsAPI(ctx *context.Context) { } } } + sort.Slice(contributorInfos, func(i, j int) bool { + return contributorInfos[i].CommitCnt > contributorInfos[j].CommitCnt + }) } else { log.Error("GetContributors failed: %v", err) errorCode = -1