From dee2d4acbc26da4c10a26cce159cbdf947486c39 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Wed, 13 Apr 2022 10:20:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AA=E6=98=BE=E7=A4=BA=E5=85=AC=E5=BC=80?= =?UTF-8?q?=E7=BB=84=E7=BB=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/org.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/org.go b/models/org.go index 28a6701c5..2a6528023 100755 --- a/models/org.go +++ b/models/org.go @@ -193,22 +193,22 @@ func (org *User) getOrgStatistics() (int, error) { } func FindTopNStarsOrgs(n int) ([]*OrgScore, error) { - sql := "select a.id,sum(b.num_stars) score from \"user\" a ,repository b where a.id=b.owner_id and a.type=1 group by a.id order by score desc limit " + strconv.Itoa(n) + sql := "select a.id,sum(b.num_stars) score from \"user\" a ,repository b where a.id=b.owner_id and a.type=1 and a.visibility=0 group by a.id order by score desc limit " + strconv.Itoa(n) return findTopNOrgs(sql) } func FindTopNMembersOrgs(n int) ([]*OrgScore, error) { sql := "select id, count(user_id) score from" + - " (select org_id as id, uid as user_id from org_user " + + " (select org_id as id, uid as user_id from org_user o, \"user\" u where o.org_id=u.id and u.visibility=0 " + "union select a.id,b.user_id from \"user\" a,collaboration b,repository c " + - "where a.type=1 and a.id=c.owner_id and b.repo_id=c.id) d " + + "where a.type=1 and a.visibility=0 and a.id=c.owner_id and b.repo_id=c.id) d " + "group by id order by score desc limit " + strconv.Itoa(n) return findTopNOrgs(sql) } func FindTopNOpenIOrgs(n int) ([]*OrgScore, error) { - sql := "select org_id id,num_score score from org_statistic order by num_score desc limit " + strconv.Itoa(n) + sql := "select org_id id,num_score score from org_statistic a, \"user\" b where a.org_id=b.id and b.visibility=0 order by num_score desc limit " + strconv.Itoa(n) return findTopNOrgs(sql) }