Initial display of the frag matrix.
[xonotic/xonstat.git] / xonstat / templates / game_info.mako
1 <%inherit file="base.mako"/>
2 <%namespace name="nav" file="nav.mako" />
3 <%namespace file="scoreboard.mako" import="scoreboard" />
4 <%namespace file="accuracy.mako" import="accuracy" />
5 <%namespace file="frag_matrix.mako" import="frag_matrix" />
6
7 <%block name="navigation">
8   ${nav.nav('games')}
9 </%block>
10
11 <%block name="foundation">
12   <script>
13   $(document).foundation({
14       accordion: {
15         multi_expand: true,
16       }
17     });
18   </script>
19 </%block>
20
21 <%block name="title">
22   Game Information
23 </%block>
24
25
26 % if game is None:
27   <h2>Sorry, that game wasn't found!</h2>
28
29 % else:
30   <div class="row">
31
32     <div class="small-12 columns">
33       <h3>Game #${game.game_id}</h3>
34       <p>
35         <span class="sprite sprite-${game.game_type_cd}"></span> ${gametype.descr} <br />
36         Played ${game.fuzzy_date()} <span class="abstime" data-epoch="${game.epoch()}" title="${game.start_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}"> <i class="fa fa-info-circle"></i></span><br />
37         Server: <a href="${request.route_url("server_info", id=server.server_id)}" name="Server info page for ${server.name}">${server.name}</a><br />
38         Map: <a href="${request.route_url("map_info", id=map.map_id)}" name="Map info page for ${map.name}">${map.name}</a><br />
39         % if game.duration is not None:
40           Duration: ${"%s:%02d" % (game.duration.seconds/60, game.duration.seconds%60)}
41         % endif
42       </p>
43     </div>
44
45     % if teamscores:
46       <div class="small-3 columns">
47         <table class="table-condensed">
48           <thead>
49             <th>Team</th>
50             <th>Score</th>
51           </thead>
52           <tbody>
53             % for ts in teamscores:
54               <tr class="${ts.team}"><td>${ts.team.capitalize()}</td><td>${ts.score}</td></tr>
55             % endfor
56           </tbody>
57         </table>
58       </div>
59     % endif
60   </div>
61
62   ##### Games that have team scores push the scoreboard table to the right by
63   ##### one column. 
64   % if len(tgstats) == len(stats_by_team):
65     % for tgstat in tgstats:
66       <div class="row">
67
68         <div class="small-1 columns teamscore">
69           <div class="teamname ${tgstat.team_html_color()}">
70             ${tgstat.team_html_color().capitalize()}
71           </div>
72           <div class="${tgstat.team_html_color()}">
73             % if game.game_type_cd == 'ctf':
74               ${tgstat.caps}
75             % elif game.game_type_cd == 'ca':
76               ${tgstat.rounds}
77             % elif game.game_type_cd == 'nb':
78               ${tgstat.caps}
79             % else:
80               ${tgstat.score}
81             % endif
82           </div>
83         </div>
84
85         <div class="small-12 medium-11 columns game">
86           ${scoreboard(game.game_type_cd, stats_by_team[tgstat.team], show_elo, show_latency)}
87         </div>
88       </div>
89     % endfor
90
91   ##### Games that do not have team scores use the full width
92   % else:
93     % for team in stats_by_team.keys():
94       <div class="row">
95         <div class="small-12 columns game">
96           ${scoreboard(game.game_type_cd, stats_by_team[team], show_elo, show_latency)}
97         </div>
98       </div>
99     % endfor
100   % endif
101
102   % if len(captimes) > 0:
103     <div class="row">
104       <div class="small-6 columns">
105         <h3>Best Flag Capture Times</h3>
106         <table class="table-hover table-condensed">
107           <thead>
108             <tr>
109               <th>Nick</th>
110               <th>Captime</th>
111             </tr>
112           </thead>
113           <tbody>
114           % for pgs in captimes:
115           <tr>
116             <td>
117               % if pgs.player_id > 2:
118               <a href="${request.route_url("player_info", id=pgs.player_id)}"
119                 title="Go to the info page for this player">
120                 <span class="nick">${pgs.nick_html_colors()|n}</span>
121               </a>
122               % else:
123               <span class="nick">${pgs.nick_html_colors()|n}</span>
124               % endif
125             </td>
126             <td>${round(float(pgs.fastest.seconds) + (pgs.fastest.microseconds/1000000.0), 2)}</td>
127           </tr>
128           % endfor
129           </tbody>
130         </table>
131       </div>
132     </div>
133   % endif
134
135   % if len(pgstats) > 0 and len(pwstats) > 0:
136     <div class="row">
137       <div class="small-12 medium-9 columns">
138           <ul class="accordion" data-accordion>
139             % for pgstat in pgstats:
140               % if pgstat.player_game_stat_id in pwstats:
141                 <li class="accordion-navigation">
142                   <a href="#accuracy-${pgstat.player_game_stat_id}">Accuracy for ${pgstat.nick_html_colors()|n}</a>
143                   <div id="accuracy-${pgstat.player_game_stat_id}" class="content">
144                     ${accuracy(pwstats[pgstat.player_game_stat_id])}
145                   </div>
146                 </li>
147               % endif
148             % endfor
149           </ul>
150         </div>
151       </div>
152   % endif
153
154   % if show_frag_matrix:
155     <div class="row">
156       <div class="small-12 columns">
157         <h3>Frag Matrix</h3>
158         ${frag_matrix(pgstats, matrix_by_pgstat_id)}
159       </div>
160     </div>
161   % endif
162
163 % endif