From 1c3ae6d05e6099d30f61a9057d8e12cdfc80975d Mon Sep 17 00:00:00 2001 From: Jimmy Praet Date: Fri, 8 Oct 2021 11:33:16 +0200 Subject: [PATCH] Fix incorrect repository count on organization tab of dashboard (#17266) Fixes #17249 --- models/org.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/org.go b/models/org.go index 4a891a83f438..f670ad2ae175 100644 --- a/models/org.go +++ b/models/org.go @@ -455,7 +455,7 @@ func GetUserOrgsList(user *User) ([]*MinimalOrg, error) { groupByStr := groupByCols.String() groupByStr = groupByStr[0 : len(groupByStr)-1] - sess.Select(groupByStr+", count(repo_id) as org_count"). + sess.Select(groupByStr+", count(distinct repo_id) as org_count"). Table("user"). Join("INNER", "team", "`team`.org_id = `user`.id"). Join("INNER", "team_user", "`team`.id = `team_user`.team_id").