Add a basic usage counter for enterprise

This commit is contained in:
Joseph Schorr 2014-10-28 16:33:13 -04:00
parent 93cd7de0e0
commit 109850b428
8 changed files with 109 additions and 29 deletions

View file

@ -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()