def run_query(regions, tiers):
    if len(regions) == 0:
        regions = static_data.regions
    if len(tiers) == 0:
        tiers = static_data.highest_achieved_season_tier
    outcome = ['won', 'lost', 'total']

    champions = static_io.read_json('champions_by_id.json')

    data = query_io.read_json('champions.json')

    result = {}

    create_empty_result_dict(result, champions, outcome)
    query_champions_json(result, data, regions, tiers, outcome, champions)
    calculate_extras(result)

    final_result = {}
    for o in outcome:
        final_result[o] = []
        for c in result:
            dict = OrderedDict({'id': c, 'name': champions[c]['name'], 'key': champions[c]['key']})
            dict.update(sorted((result[c][o]).items()))
            final_result[o].append(dict)

    return final_result
Example #2
0
def run_query(regions = get_match_data.get_match_regions(), tiers = static_data.highest_achieved_season_tier):

    minions = static_io.read_json('minions_by_id.json')
    upgrades = static_io.read_json('upgrades_by_id.json')

    data = query_io.read_json('minions.json')

    result = {}

    create_query_result_dict(result, minions, upgrades)
    query_minions_json(result, data, regions, tiers, minions, upgrades)
    calculate_extras(result)

    query_io.write_json(result, 'test.json')

    return result_breakdown(result)