def playerinfo(self, ids, statstype): tmpl_header, tmpl_footer = Html.loadtemplates() output = tmpl_header.substitute() output += '<h1>Player stats</h1>' output += '<table cellspacing="0" cellpadding="2">' output += '<tr>' + Html.list2cols(['Nick', 'MMR', 'K', 'D', 'A', 'W/G', 'CD', 'KDR', 'GP', 'Wins', 'Losses', 'W%'], 'th') + '</tr>' for id_ in ids: data = self.dp.fetchplayer(id_, statstype) nickname = self.dp.id2nick(int(data['account_id'])) player = Player(nickname, data) pdata = [player.rating(statstype), player.kills(statstype), player.deaths(statstype), player.assists(statstype), round(player.wards(statstype)/player.gamesplayed(statstype), 2), round(player.denies(statstype)/player.gamesplayed(statstype), 2), round(player.kills(statstype)/player.deaths(statstype), 2), player.gamesplayed(statstype), player.wins(statstype), player.losses(statstype), round(player.wins(statstype)/player.gamesplayed(statstype) * 100, 2)] output += '<tr><td><a href="/matches/{nick}">{nick}</a></td>'.format(nick=nickname) output += Html.list2cols(pdata) output += '</tr>' output += '</table>' output += tmpl_footer.substitute() return output