Browse Source

只显示公开组织

tags/v1.22.4.1^2
ychao_1983 3 years ago
parent
commit
dee2d4acbc
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      models/org.go

+ 4
- 4
models/org.go View File

@@ -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)
}


Loading…
Cancel
Save