Fix incorrect repository count on organization tab of dashboard (#17266)

Fixes #17249
release/v1.15
Jimmy Praet 2021-10-08 11:33:16 +02:00 committed by GitHub
parent a1e57ebe6b
commit 1c3ae6d05e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -455,7 +455,7 @@ func GetUserOrgsList(user *User) ([]*MinimalOrg, error) {
groupByStr := groupByCols.String() groupByStr := groupByCols.String()
groupByStr = groupByStr[0 : len(groupByStr)-1] 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"). Table("user").
Join("INNER", "team", "`team`.org_id = `user`.id"). Join("INNER", "team", "`team`.org_id = `user`.id").
Join("INNER", "team_user", "`team`.id = `team_user`.team_id"). Join("INNER", "team_user", "`team`.id = `team_user`.team_id").