Fix postgres error in SQL query
This commit is contained in:
parent
1eec6f53b2
commit
117ccda1cf
1 changed files with 3 additions and 1 deletions
|
@ -231,6 +231,8 @@ def get_visible_repositories(username, namespace=None, include_public=False):
|
||||||
""" Returns the repositories visible to the given user (if any).
|
""" Returns the repositories visible to the given user (if any).
|
||||||
"""
|
"""
|
||||||
if not include_public and not username:
|
if not include_public and not username:
|
||||||
|
# Short circuit by returning a query that will find no repositories. We need to return a query
|
||||||
|
# here, as it will be modified by other queries later on.
|
||||||
return Repository.select().where(Repository.id == -1)
|
return Repository.select().where(Repository.id == -1)
|
||||||
|
|
||||||
query = (Repository
|
query = (Repository
|
||||||
|
@ -394,6 +396,6 @@ def list_popular_public_repos(action_count_threshold, time_span):
|
||||||
.join(RepositoryActionCount)
|
.join(RepositoryActionCount)
|
||||||
.where(RepositoryActionCount.date >= cutoff,
|
.where(RepositoryActionCount.date >= cutoff,
|
||||||
Repository.visibility == get_public_repo_visibility())
|
Repository.visibility == get_public_repo_visibility())
|
||||||
.group_by(RepositoryActionCount.repository)
|
.group_by(RepositoryActionCount.repository, Repository.name, Namespace.username)
|
||||||
.having(fn.Sum(RepositoryActionCount.count) >= action_count_threshold)
|
.having(fn.Sum(RepositoryActionCount.count) >= action_count_threshold)
|
||||||
.tuples())
|
.tuples())
|
||||||
|
|
Reference in a new issue