def author_stats_table(scope, limit=None): """ this drives the author tables, both ranged and non-ranged, accessed off the main repo list. the interval 'LF' shows lifetime stats, but elsewhere we just do daily roundups, so this parameter should really be a boolean. The limit parameter is not yet used. """ results = [] interval = scope.interval if interval != 'LF': interval = 'DY' authors = None if scope.repo: authors = Author.authors(scope.repo, scope.start, scope.end) def add_stat(author, repo): stat1 = Statistic.queryset_for_range(repo, author=author, start=scope.start, end=scope.end, interval=scope.interval) stat2 = Statistic.compute_interval_statistic(stat1, interval=scope.interval, repo=repo, author=author, start=scope.start, end=scope.end) stat2 = stat2.to_dict() stat2['author'] = author.email stat2['repo'] = repo.name if stat2['lines_changed']: # skip authors with no contribution in the time range results.append(stat2) if not scope.author and scope.repo: for author in authors: add_stat(author, scope.repo) elif scope.author and not scope.repo: for repo in scope.author.repos(): add_stat(scope.author, repo) elif scope.author and scope.repo: add_stat(scope.author, scope.repo) return results
def get_authors_for_repo(cls, repo): """ Return the authors involved in the repo """ return Author.authors(repo)