Get the main repo page design working

This commit is contained in:
Joseph Schorr 2015-03-10 17:22:46 -07:00
parent 3d3c8ca198
commit 002dc083f2
18 changed files with 299 additions and 18 deletions

View file

@ -2537,6 +2537,26 @@ def cancel_repository_build(build, work_queue):
build.delete_instance()
return True
def get_repository_pushes(repository, time_delta):
since = date.today() - time_delta
push_repo = LogEntryKind.get(name = 'push_repo')
return (LogEntry.select()
.where(LogEntry.repository == repository)
.where(LogEntry.kind == push_repo)
.where(LogEntry.datetime >= since)
.count())
def get_repository_pulls(repository, time_delta):
since = date.today() - time_delta
repo_pull = LogEntryKind.get(name = 'pull_repo')
repo_verb = LogEntryKind.get(name = 'repo_verb')
return (LogEntry.select()
.where(LogEntry.repository == repository)
.where((LogEntry.kind == repo_pull) | (LogEntry.kind == repo_verb))
.where(LogEntry.datetime >= since)
.count())
def get_repository_usage():
one_month_ago = date.today() - timedelta(weeks=4)
repo_pull = LogEntryKind.get(name = 'pull_repo')