fix: wrong pages number which includes private repository count. (#844)

This commit is contained in:
Bo-Yi Wu 2017-02-06 23:18:36 +08:00 committed by Lunny Xiao
parent 76969a5671
commit 71d35dae8c
4 changed files with 105 additions and 4 deletions

View file

@ -1737,11 +1737,29 @@ func getRepositoryCount(e Engine, u *User) (int64, error) {
return x.Count(&Repository{OwnerID: u.ID})
}
func getPublicRepositoryCount(e Engine, u *User) (int64, error) {
return x.Where("is_private = ?", false).Count(&Repository{OwnerID: u.ID})
}
func getPrivateRepositoryCount(e Engine, u *User) (int64, error) {
return x.Where("is_private = ?", true).Count(&Repository{OwnerID: u.ID})
}
// GetRepositoryCount returns the total number of repositories of user.
func GetRepositoryCount(u *User) (int64, error) {
return getRepositoryCount(x, u)
}
// GetPublicRepositoryCount returns the total number of public repositories of user.
func GetPublicRepositoryCount(u *User) (int64, error) {
return getPublicRepositoryCount(x, u)
}
// GetPrivateRepositoryCount returns the total number of private repositories of user.
func GetPrivateRepositoryCount(u *User) (int64, error) {
return getPrivateRepositoryCount(x, u)
}
// SearchRepoOptions holds the search options
type SearchRepoOptions struct {
Keyword string