From f3203272e226a9a1386311a93c7eda4f33940bcd Mon Sep 17 00:00:00 2001 From: wemeya Date: Wed, 22 Jun 2016 16:36:36 +0800 Subject: [PATCH] modify sql where condition --- dao/accesslog.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dao/accesslog.go b/dao/accesslog.go index c9f887029..930607701 100644 --- a/dao/accesslog.go +++ b/dao/accesslog.go @@ -150,8 +150,8 @@ func GetRecentLogs(userID, linesNum int, startTime, endTime string) ([]models.Ac func GetTopRepos(countNum int) ([]models.TopRepo, error) { o := GetOrmer() - - sql := "select repo_name, COUNT(repo_name) as access_count from access_log left join project on access_log.project_id=project.project_id where project.public = 1 and access_log.operation = 'pull' group by repo_name order by access_count desc limit ? " + // hide the where condition: project.public = 1, Can add to the sql when necessary. + sql := "select repo_name, COUNT(repo_name) as access_count from access_log left join project on access_log.project_id=project.project_id where access_log.operation = 'pull' group by repo_name order by access_count desc limit ? " queryParam := []interface{}{} queryParam = append(queryParam, countNum) var list []models.TopRepo