示例#1
0
def team_impact_graph(request):
    if request.method == 'POST':
        username = request.values['values']
        print(username)
        dict['name'] = username
        multiplier, repo = function_with_cache(find_multiplier, [username])
        top_contributors = function_with_cache(get_top_contributors, [repo])
        cleaned_top_contributors = []
        for contributor in top_contributors:
            if contributor[1] != username:
                cleaned_top_contributors.append(contributor)
        top_contributors_list = []
        max_val = cleaned_top_contributors[0][0]
        for element in cleaned_top_contributors:
            scaled = element[0] / max_val * 50
            dict_form = {
                'userId': element[1],
                'before': scaled,
                'after': scaled * multiplier
            }
            top_contributors_list.append(dict_form)
        self_info = [[{'userId': username}]]
        top_contributors_list = [[top_contributors_list]]
        dict_form = {'data': top_contributors_list, 'personalData': self_info}
        return dict_form
    elif request.method == 'GET':
        print("yo")
        return jsonify(dict)
示例#2
0
def get_additional_team(username):
    dict_all = function_with_cache(data_dict, [username])
    dict_form = {
        'inspiration_coefficient': dict_all['inspiration_coefficient'],
        'team_value': dict_all['team_value']
    }
    return dict_form
示例#3
0
def get_additional_potential(username):
    dict_all = function_with_cache(data_dict, [username])
    dict_form = {
        'java_expertise': dict_all['java_expertise'],
        'commitment': dict_all['commitment']
    }
    return dict_form
示例#4
0
def find_multiplier(github_id):
    result = function_with_cache(data_dict, [github_id])
    if 'impact_repos' in result.keys() and result['impact_repos']:
        repo = result['impact_repos']
        multiplier = result['impact_rates']
        print(repo)
        return multiplier, repo[0]
    return 1.5, 'pytorch/pytorch'
示例#5
0
def test():
    def test_function(first, last):
        print(first, last)
        return {'first': first, 'last': last}

    test_vals = [[0, 1], [1, 3], [0, 1]]
    for val in test_vals:
        result = function_with_cache(test_function, val)
    return jsonify(result)
示例#6
0
def potential_number(request):
    if request.method == 'POST':
        username = request.values['values']
        print(username)
        dict['name'] = username
        dict_form = {'number': function_with_cache(get_potential, [username])}
        return dict_form
    elif request.method == 'GET':
        print("yo")
        return jsonify(dict)
示例#7
0
def team_number_additional(request):
    if request.method == 'POST':
        username = request.values['values']
        print(username)
        dict['name'] = username
        dict_form = function_with_cache(get_additional_team, [username])
        return dict_form
    elif request.method == 'GET':
        print("yo")
        return jsonify(dict)
示例#8
0
def future_graph(request):
    if request.method == 'POST':
        username = request.values['values']
        print(username)
        dict['name'] = username
        past_data, future_data = function_with_cache(predict_future,
                                                     [username])
        dict_form = {'future_data': future_data, 'past_data': past_data}
        return dict_form
    elif request.method == 'GET':
        print("yo")
        return jsonify(dict)
示例#9
0
def get_world(username):
    dict_all = function_with_cache(data_dict, [username])
    return dict_all['world_impact']
示例#10
0
def get_potential(username):
    dict_all = function_with_cache(data_dict, [username])
    return dict_all['potential_impact']
示例#11
0
def get_team(username):
    dict_all = function_with_cache(data_dict, [username])
    return dict_all['team_impact']
示例#12
0
def get_additional_world(username):
    dict_all = function_with_cache(data_dict, [username])
    dict_form = {'repository_impact': dict_all['repository_impact']}
    return dict_form