def load_into_db(req_type=None,req_id=None,cursor=None): # get account from name and load account details into account # get refreshed match_list from id and load new matches into account # get a match_detail from match_id and load into match_detail if req_type is 'account': name_to_acc.account_id_from_name(req_id,cursor) elif req_type is 'match_list': acc_to_matches.all_matches(req_id,refresh_flag=True,cursor=cursor) elif req_type is 'match_detail': match_detail.match_data_from_id(req_id,cursor)
def inner(m_id): m_d = match_detail.match_data_from_id(m_id) if m_d is None: return None in_map = match_detail.inter_map(m_d) player_data = match_detail.id_to_data(in_map,account_id,id_type='account_id',result_type='part_data') if player_data is None: return None return single_player_stats_wanted(player_data)
def inner(m): m_d = match_detail.match_data_from_id(m) if m_d is None: return False part_list = m_d['participants'] res = True for p in part_list: if p['teamId'] == teamid: res = res and player_cond_predicate(p) return res
def inner(m_id, cursor): m_d = match_detail.match_data_from_id(m_id, cursor) if m_d is None: return False in_map = match_detail.inter_map(m_d) part_data = match_detail.id_to_data(in_map, id, id_type='account_id', result_type='part_data') if part_data is None: return False return player_cond_predicate(part_data)
def inner(m, cursor): m_d = match_detail.match_data_from_id(m, cursor) if m_d is None: return False in_map = match_detail.inter_map(m_d) for a in acc_id_li: t_d = match_detail.id_to_data(in_map, a, id_type='account_id', result_type='team_data') if t_d is not None: break return team_cond_predicate(t_d)
def solo_win_rate_for_id(id): matches = acc_to_matches.solo_q_matches(id) win, loss = 0, 0 for matchgen in matches: match_id = matchgen['gameId'] m = match_detail.match_data_from_id(match_id) if is_remake(m) is False: if is_win(m, id): win += 1 else: loss += 1 #get the match data and find out whether it was a win total = win + loss print("wins are " + str(win)) print("losses are " + str(loss)) return win * 1.0 / total * 1.0
def win_rate_for_champion(name, champion_name): id = name_to_acc.account_id_from_name(name) matches = acc_to_matches.matches_from_id(id) print("whoop ") win, loss = 0, 0 print(len(matches)) for matchgen in matches: match_id = matchgen['gameId'] if playschamp(matchgen, champion_name) is False: continue m = match_detail.match_data_from_id(match_id) if is_win(m, id): win += 1 else: loss += 1 total = win + loss print(win) print(loss) return win * 1.0 / total * 1.0
def inner(m, cursor): m_d = match_detail.match_data_from_id(m, cursor) if m_d is None: return False return game_cond_predicate(m_d)