diff --git a/data/model/legacy.py b/data/model/legacy.py index 9050830ef..c31c553b7 100644 --- a/data/model/legacy.py +++ b/data/model/legacy.py @@ -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():