Add a basic usage counter for enterprise
This commit is contained in:
parent
93cd7de0e0
commit
109850b428
8 changed files with 109 additions and 29 deletions
|
@ -2210,6 +2210,14 @@ def confirm_team_invite(code, user):
|
|||
found.delete_instance()
|
||||
return (team, inviter)
|
||||
|
||||
|
||||
def get_repository_usage():
|
||||
repo_pull = LogEntryKind.get(name = 'pull_repo')
|
||||
return (LogEntry.select().where(LogEntry.kind == repo_pull, ~(LogEntry.repository >> None))
|
||||
.group_by(LogEntry.ip)
|
||||
.group_by(LogEntry.repository)
|
||||
.count())
|
||||
|
||||
def archivable_buildlogs_query():
|
||||
presumed_dead_date = datetime.utcnow() - PRESUMED_DEAD_BUILD_AGE
|
||||
return (RepositoryBuild.select()
|
||||
|
|
Reference in a new issue