API_Github Conecctor finished

This commit is contained in:
Sagi Dayan 2015-06-29 17:56:58 +03:00
parent 7cfe2f527d
commit 6bc9420038

View file

@ -36,15 +36,22 @@ def make_macro(stats, info):
return macro return macro
# def make_micro(stats, info): def make_micro(stats, issues):
# micro = {'labels': [], 'data': [[]], 'series': []} micro = {'labels': [], 'data': [], 'series': []}
# micro['labels'].append('Commits') micro['labels'].append('Commits')
# micro['labels'].append('Open Issues') micro['labels'].append('Open Issues')
# for stat in stats: for stat in stats:
# micro['data'][0][0] += stat['total'] micro['series'].append(stat['author']['login'])
# micro['data'].append(info['open_issues']) micro['data'].append([stat['total'], get_issue_num(issues, stat['author']['login'])])
#
# return micro return micro
def get_issue_num(issues, user):
numOfIssues = 0
for issue in issues:
if issue['user']['login'] == user:
numOfIssues += 1
return numOfIssues
def get_github_data(repo_url): def get_github_data(repo_url):
project_info = {'stats': {}} project_info = {'stats': {}}
@ -54,7 +61,7 @@ def get_github_data(repo_url):
weekly_commits = get_repo_weekly_commits(repo_url) weekly_commits = get_repo_weekly_commits(repo_url)
github_stats = get_repo_stats(repo_url) #Second Call github_stats = get_repo_stats(repo_url) #Second Call
project_info['stats']['macro'] = make_macro(github_stats, project_info['info']) project_info['stats']['macro'] = make_macro(github_stats, project_info['info'])
project_info['stats']['micro'] = make_micro(github_stats, issues)
project_info['stats']['weekly_commits'] = weekly_commits project_info['stats']['weekly_commits'] = weekly_commits
project_info['issues'] = issues project_info['issues'] = issues