]> de.git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/templates/player_info.mako
No longer need old damage and accuracy templates.
[xonotic/xonstat.git] / xonstat / templates / player_info.mako
1 <%inherit file="base.mako"/>
2 <%namespace name="nav" file="nav.mako" />
3
4 <%block name="navigation">
5 ${nav.nav('players')}
6 </%block>
7
8 <%block name="css">
9 ${parent.css()}
10 <link href="/static/css/sprites.css" rel="stylesheet">
11 <link href="/static/css/nv.d3.css" rel="stylesheet" type="text/css">
12 <style>
13 #damageChartSVG, #accuracyChartSVG {
14   height: 300px;
15 }
16 </style>
17 </%block>
18
19 <%block name="js">
20 ${parent.js()}
21 <script src="/static/js/d3.v3.min.js"></script>
22 <script src="/static/js/nv.d3.min.js"></script>
23 <script src="/static/js/weaponCharts.js"></script>
24 <script type="text/javascript">
25 // tabs
26 $(function () {
27   $('#gbtab li').click(function(e) {
28     e.preventDefault();
29     $(this).tab('show');
30   })
31
32   $('#gbtab a:first').tab('show');
33 })
34
35 // weapon accuracy and damage charts
36 d3.json("${request.route_url('player_weaponstats_data_json', id=player.player_id)}", function(err, data) {
37   drawDamageChart(data);
38   drawAccuracyChart(data);
39 });
40
41 % for g in games_played:
42 d3.select('.tab-${g.game_type_cd}').on("click", function() {
43   // have to remove the chart each time
44   d3.select('#damageChartSVG .nvd3').remove();
45   d3.select('#accuracyChartSVG .nvd3').remove();
46   d3.json("${request.route_url('player_weaponstats_data_json', id=player.player_id, _query={'limit':20, 'game_type':g.game_type_cd})}", function(err, data) {
47     drawDamageChart(data);
48     drawAccuracyChart(data);
49   });
50 });
51 % endfor
52
53 </script>
54 </%block>
55
56 <%block name="title">
57 Player Information
58 </%block>
59
60 <div class="row">
61   <div class="span12">
62     <h2>
63       ${player.nick_html_colors()|n}
64     </h2>
65     <h4>
66       <i><span class="abstime" data-epoch="${player.epoch()}" title="${player.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">Joined ${player.joined_pretty_date()}</span> (player #${player.player_id})</i>
67       % if cake_day:
68       <img src="/static/images/icons/24x24/cake.png" title="Happy cake day!" />
69       % endif
70     </h4>
71   </div>
72 </div>
73
74 <div class="row">
75   <div id="gbtabcontainer" class="tabbable tabs-below">
76     <div class="tab-content">
77       % for g in games_played:
78       % if not g.game_type_cd in ['cq']:
79       <div class="tab-pane fade in 
80         % if g.game_type_cd == 'overall':
81         active
82         % endif
83         " id="tab-${g.game_type_cd}">
84         <div class="span5">
85           <p>
86           % if g.game_type_cd in overall_stats:
87           Last Played: <small><span class="abstime" data-epoch="${overall_stats[g.game_type_cd].last_played_epoch}" title="${overall_stats[g.game_type_cd].last_played.strftime('%a, %d %b %Y %H:%M:%S UTC')}"> ${overall_stats[g.game_type_cd].last_played_fuzzy} </span> <br /></small>
88           % else:
89           <small><br /></small>
90           % endif
91
92           Games Played: 
93           % if g.game_type_cd == 'overall':
94           <small><a href="${request.route_url("player_game_index", player_id=player.player_id)}" title="View recent games">
95           % else:
96           <small><a href="${request.route_url("player_game_index", player_id=player.player_id, _query={'type':g.game_type_cd})}" title="View recent ${overall_stats[g.game_type_cd].game_type_descr} games">
97           % endif
98           ${g.games}</a> <br /></small>
99
100           Playing Time: <small>${overall_stats[g.game_type_cd].total_playing_time} <br /></small>
101
102           % if g.game_type_cd in fav_maps:
103           Favorite Map: <small><a href="${request.route_url("map_info", id=fav_maps[g.game_type_cd].map_id)}" title="Go to the detail page for this map">${fav_maps[g.game_type_cd].map_name}</a> <br /></small>
104           % else:
105           <small><br /></small>
106           % endif
107
108           % if g.game_type_cd == 'ctf':
109           % if overall_stats[g.game_type_cd].total_captures is not None:
110           <small><a href="${request.route_url("player_captimes", id=player.player_id)}">Fastest flag captures...</a> <br /></small>
111           % else:
112           <small><br /></small>
113           % endif
114           % else:
115           <small><br /></small>
116           % endif
117
118           </p>
119         </div>
120         <div class="span5">
121           <p>
122           Win Percentage: <small>${round(g.win_pct,2)}% (${g.wins} wins, ${g.losses} losses) <br /></small>
123
124           % if g.game_type_cd in overall_stats:
125           % if overall_stats[g.game_type_cd].k_d_ratio is not None:
126           Kill Ratio: <small>${round(overall_stats[g.game_type_cd].k_d_ratio,2)} (${overall_stats[g.game_type_cd].total_kills} kills, ${overall_stats[g.game_type_cd].total_deaths} deaths) <br /></small>
127           % endif
128           % else:
129           <small><br /></small>
130           % endif
131
132           % if g.game_type_cd in elos:
133           % if g.game_type_cd == 'overall':
134           Best Elo: <small>${round(elos[g.game_type_cd].elo,2)} (${elos[g.game_type_cd].game_type_cd}, ${elos[g.game_type_cd].games} games) <br /></small>
135           % else:
136           Elo: <small>${round(elos[g.game_type_cd].elo,2)} (${elos[g.game_type_cd].games} games) <br /></small>
137           % endif
138           % else:
139           <small><br /></small>
140           % endif
141
142           % if g.game_type_cd in ranks:
143           % if g.game_type_cd == 'overall':
144           Best Rank: <small>${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank} (${ranks[g.game_type_cd].game_type_cd}, percentile: ${round(ranks[g.game_type_cd].percentile,2)}) <br /></small>
145           % else:
146           Rank: 
147           <small>
148             <a href="
149               % if ranks[g.game_type_cd].rank % 20 == 0:
150                 ${request.route_url('rank_index', game_type_cd=g.game_type_cd, _query={'page':ranks[g.game_type_cd].rank/20})}
151
152               % else:
153                 ${request.route_url('rank_index', game_type_cd=g.game_type_cd, _query={'page':ranks[g.game_type_cd].rank/20+1})}
154
155               % endif
156             " title="Player rank page for this player">
157             ${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank}</a>
158             (percentile: ${round(ranks[g.game_type_cd].percentile,2)})
159             <br />
160           </small>
161           % endif
162           % else:
163           <small><br /></small>
164           % endif
165
166           % if g.game_type_cd == 'ctf':
167           % if overall_stats[g.game_type_cd].cap_ratio is not None:
168           Cap Ratio: <small>${round(overall_stats[g.game_type_cd].cap_ratio,2)} (${overall_stats[g.game_type_cd].total_captures} captures, ${overall_stats[g.game_type_cd].total_pickups} pickups) <br /></small>
169           % else:
170           <small><br /></small>
171           % endif
172           % else:
173           <small><br /></small>
174           % endif
175           </p>
176         </div>
177       </div>
178       % endif
179       % endfor
180     </div>
181   </div>
182 </div>
183 <div class="row">
184   <div class="span12">
185     <ul id="gbtab" class="nav nav-tabs">
186       % for g in games_played:
187       <li class="tab-${g.game_type_cd}">
188       <a href="#tab-${g.game_type_cd}" data-toggle="tab" alt="${g.game_type_cd}" title="${overall_stats[g.game_type_cd].game_type_descr}">
189         <span class="sprite sprite-${g.game_type_cd}"> </span><br />
190         ${g.game_type_cd} <br />
191         <small>(${g.games})</small>
192       </a>
193       </li>
194       % endfor
195     </ul>
196   </div>
197 </div>
198
199
200 ##### Weapon Accuracy Chart ####
201 <div class="row">
202   <div class="span12">
203     <h3>Weapon Accuracy</h3>
204     <div id="accuracyChart">
205       <svg id="accuracyChartSVG"></svg>
206     </div>
207   </div> <!-- end span12 -->
208 </div> <!-- end row -->
209
210
211 ##### Weapon Damage Chart ####
212 <div class="row">
213   <div class="span12">
214     <h3>Weapon Damage</h3>
215     <div id="damageChart">
216       <svg id="damageChartSVG"></svg>
217     </div>
218   </div> <!-- end span12 -->
219 </div> <!-- end row -->
220
221
222
223 ##### RECENT GAMES (v2) ####
224 % if recent_games:
225 <div class="row">
226   <div class="span12">
227     <h3>Recent Games</h3>
228     <table class="table table-hover table-condensed">
229       <thead>
230         <tr>
231           <th></th>
232           <th>Type</th>
233           <th>Server</th>
234           <th>Map</th>
235           <th>Result</th>
236           <th>Played</th>
237           <th>Elo</th>
238         </tr>
239       </thead>
240       <tbody>
241       % for rg in recent_games:
242       <tr>
243         <td class="tdcenter"><a class="btn btn-primary btn-small" href="${request.route_url('game_info', id=rg.game_id)}" title="View detailed information about this game">view</a></td>
244         <td class="tdcenter"><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}" title="${rg.game_type_descr}"></span></td>
245         <td><a href="${request.route_url('server_info', id=rg.server_id)}" title="Go to the detail page for this server">${rg.server_name}</a></td>
246         <td><a href="${request.route_url('map_info', id=rg.map_id)}" title="Go to the detail page for this map">${rg.map_name}</a></td>
247         <td>
248           % if rg.team != None:
249           % if rg.team == rg.winner:
250           Win
251           % else:
252           Loss
253           % endif
254           % else:
255           % if rg.rank == 1:
256           Win
257           % else:
258           Loss (#${rg.rank})
259           % endif
260           % endif
261         </td>
262         <td><span class="abstime" data-epoch="${rg.epoch}" title="${rg.start_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${rg.fuzzy_date}</span></td>
263         <td class="tdcenter">
264           <a href="${request.route_url('game_info', id=rg.game_id, _query={'show_elo':1})}" title="View detailed information about this game">
265             % if rg.elo_delta is not None:
266             % if round(rg.elo_delta,2) > 0:
267             <span class="eloup" title="Elo went up by ${round(rg.elo_delta,2)}"><i class="glyphicon glyphicon-arrow-up"></i></span>
268             % elif round(rg.elo_delta,2) < 0:
269             <span class="elodown" title="Elo went down by ${round(-rg.elo_delta,2)}"><i class="glyphicon glyphicon-arrow-down"></i></span>
270             % else:
271             <span class="eloneutral" title="Elo did not change"><i class="glyphicon glyphicon-minus"></i></span>
272             % endif
273             % else:
274             <span class="eloneutral" title="Elo did not change"><i class="glyphicon glyphicon-minus"></i></span>
275             % endif
276           </a>
277         </td>
278       </tr>
279       % endfor
280       </tbody>
281     </table>
282     % if total_games > 10:
283     <p><a href="${request.route_url("player_game_index", player_id=player.player_id, page=1)}" title="Game index for ${player.stripped_nick}">More...</a></p>
284     % endif
285   </div>
286 </div>
287 % endif