]> git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/templates/player_info.mako
Adds an accuracy graph and removes the overall accuracy table.
[xonotic/xonstat.git] / xonstat / templates / player_info.mako
1 <%inherit file="base.mako"/>
2 <%namespace name="nav" file="nav.mako" />
3 <%namespace file="accuracy.mako" import="accuracy" />
4
5 <%block name="navigation">
6 ${nav.nav('players')}
7 </%block>
8
9 <%block name="js">
10       <script src="/static/js/jquery-1.7.1.min.js"></script>
11       <script src="/static/js/jquery.flot.min.js"></script>
12       <script type="text/javascript">
13           var avg = ${avg};
14           var accs = ${accs};
15
16           $.plot($("#acc-graph"), [
17             { data: avg },
18             { data: accs },
19           ],
20           { yaxis: {ticks: 10, min: 0, max: 100 },
21           });
22       </script>
23 </%block>
24
25 <%block name="title">
26 Player Information
27 </%block>
28
29
30 % if player is None:
31 <h2>This player is so good we couldn't find him!</h2>
32 <p>Seriously though, he probably doesn't exist...just a figment of your imagination. Carry on then!</p>
33
34 % else:
35 <div class="row">
36   <div class="span8">
37     <h2>${player.nick_html_colors()|n}</h2>
38     <p>
39        Member Since: <small>${player.create_dt.strftime('%m/%d/%Y at %I:%M %p')} </small><br />
40        Last Seen: <small>${recent_games[0][1].fuzzy_date()} </small><br />
41        Playing Time: <small>${total_stats['alivetime']} </small><br />
42        % if total_games > 0 and total_stats['wins'] is not None:
43        Win Percentage: <small>${round(float(total_stats['wins'])/total_games * 100, 2)}% (${total_stats['wins']} wins, ${total_games - total_stats['wins']} losses) </small><br />
44        % endif
45        % if total_stats['kills'] > 0 and total_stats['deaths'] > 0:
46        Kill Ratio: <small>${round(float(total_stats['kills'])/total_stats['deaths'], 3)} (${total_stats['kills']} kills, ${total_stats['deaths']} deaths) </small><br />
47        % endif
48        <% games_breakdown_str = ', '.join(["{0} {1}".format(ng, gt) for (gt, ng) in games_breakdown]) %>
49        Games Played: <small>${total_games} (${games_breakdown_str})</small><br />
50        % if elos_display is not None and len(elos_display) > 0:
51        Elo:
52           <small>${', '.join(elos_display)} </small>
53           <br />
54           %if '*' in ', '.join(elos_display):
55               <small><i>*preliminary Elo</i></small>
56           %endif
57       % endif
58     </p>
59   </div>
60 </div>
61 % endif
62
63
64 % if accs is not None:
65 <div class="row">
66   <div class="span10">
67     <h3>Nex Accuracy</h3>
68     <div id="acc-graph" style="width:800px; height:200px;">
69     </div>
70   </div>
71 </div>
72 % endif
73
74
75 ##### RECENT GAMES (v2) ####
76 % if recent_games:
77 <div class="row">
78   <div class="span12">
79     <h3>Recent Games</h3>
80     <table class="table table-bordered table-condensed">
81       <thead>
82         <tr>
83            <th></th>
84            <th>Type</th>
85            <th>Server</th>
86            <th>Map</th>
87            <th>Result</th>
88            <th>Played</th>
89         </tr>
90       </thead>
91       <tbody>
92       % for (gamestat, game, server, map) in recent_games:
93         <tr>
94            <td><a class="btn btn-primary btn-small" href="${request.route_url('game_info', id=game.game_id)}" title="View detailed information about this game">view</a></td>
95            <td style="width:20px;"><img title="${game.game_type_cd}" src="/static/images/icons/24x24/${game.game_type_cd}.png" alt="${game.game_type_cd}" /></td>
96            <td>${server.name}</td>
97            <td>${map.name}</td>
98            <td>
99            % if gamestat.team != None:
100              % if gamestat.team == game.winner:
101              Win
102              % else:
103              Loss
104              % endif
105           % else:
106             % if gamestat.rank == 1:
107             Win
108             % else:
109             Loss (#${gamestat.rank})
110             % endif
111           % endif
112            </td>
113            <td>${game.fuzzy_date()}</td>
114         </tr>
115       % endfor
116       </tbody>
117     </table>
118     % if total_games > 10:
119     <a href="${request.route_url("player_game_index", player_id=player.player_id, page=1)}" title="Game index for ${player.nick}">More games played by ${player.nick_html_colors()|n}...</a>
120     % endif
121   </div>
122 </div>
123 % endif