Fix group_by clauses for postgres
This commit is contained in:
parent
079289c53c
commit
a2e2dcb010
1 changed files with 3 additions and 4 deletions
|
@ -626,7 +626,7 @@ def get_matching_users(username_prefix, robot_namespace=None,
|
|||
|
||||
query = (User
|
||||
.select(User.username, User.robot)
|
||||
.group_by(User.username)
|
||||
.group_by(User.username, User.robot)
|
||||
.where(direct_user_query))
|
||||
|
||||
if organization:
|
||||
|
@ -2309,12 +2309,11 @@ def get_repository_usage():
|
|||
one_month_ago = date.today() - timedelta(weeks=4)
|
||||
repo_pull = LogEntryKind.get(name = 'pull_repo')
|
||||
repo_verb = LogEntryKind.get(name = 'repo_verb')
|
||||
return (LogEntry.select()
|
||||
return (LogEntry.select(LogEntry.ip, LogEntry.repository)
|
||||
.where((LogEntry.kind == repo_pull) | (LogEntry.kind == repo_verb))
|
||||
.where(~(LogEntry.repository >> None))
|
||||
.where(LogEntry.datetime >= one_month_ago)
|
||||
.group_by(LogEntry.ip)
|
||||
.group_by(LogEntry.repository)
|
||||
.group_by(LogEntry.ip, LogEntry.repository)
|
||||
.count())
|
||||
|
||||
def archivable_buildlogs_query():
|
||||
|
|
Reference in a new issue