Example #1
0
def run_query(regions, tiers):
    if len(regions) == 0:
        regions=static_data.regions
    if len(tiers) == 0:
        tiers = static_data.highest_achieved_season_tier

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

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

    result = {}

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

    winrate = []
    pickrate = []
    for key, value in result.items():
        winrate.append([key, value['key'], value['winrate']])
        pickrate.append([key, value['key'], value['pickrate'], value['won'] + value['lost']])
    winrate = sorted(sorted(winrate, key=lambda x: x[1], reverse=False), key=lambda x: x[2], reverse=True)
    pickrate = sorted(sorted(pickrate, key=lambda x: x[1], reverse=False), key=lambda x: x[2], reverse=True)

    result = {'winrate': winrate, 'pickrate': pickrate}
    return 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_champions_json(result, data, regions, tiers, minions, upgrades)
    calculate_extras(result)

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

    return result_breakdown(result)