]> git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/templates/main_index.mako
Simplify the rank table calculations. Woohoo, negative LOC!
[xonotic/xonstat.git] / xonstat / templates / main_index.mako
1 <%inherit file="base.mako"/>
2
3 <%block name="title">
4 Leaderboard
5 </%block>
6
7 <%block name="css">
8     ${parent.css()}
9     <link href="/static/css/sprites.css" rel="stylesheet">
10 </%block>
11
12 <%block name="hero_unit">
13       <div class="hero-unit">
14         <img src="/static/css/img/web_background_l2.png" />
15         % if summary_stats is None:
16         <p id="statline">Tracking Xonotic statistics since October 2011.</p>
17         % else:
18         <p id="statline">Tracking <a href="${request.route_url('player_index')}">${summary_stats.total_players}</a> players, <a href="${request.route_url('game_index')}">${summary_stats.total_games}</a> games (${summary_stats.duel_games} duel, ${summary_stats.ctf_games} ctf, ${summary_stats.dm_games} dm), and <a href="${request.route_url('server_index')}">${summary_stats.total_servers}</a> servers since October 2011.</p>
19         % endif
20       </div>
21 </%block>
22
23 % if len(ranks) < 3:
24 <div class="row">
25   <div class="span12">
26     <p style="text-align: center;"><i class="icon-white icon-info-sign"> </i> You don't seem to have any ranks yet.</p>
27   </div> <!-- span12 -->
28 </div> <!-- row -->
29 % else:
30 <div class="row">
31 % for rs in ranks[:3]:
32   % if len(rs) > 0:
33   <div class="span4">
34
35     % if rs[0].game_type_cd == 'duel':
36     <h3>Duel Ranks</h3>
37     % elif rs[0].game_type_cd == 'ctf':
38     <h3>CTF Ranks</h3>
39     % elif rs[0].game_type_cd == 'dm':
40     <h3>DM Ranks</h3>
41     % endif
42
43     <table class="table table-bordered table-condensed">
44       <thead>
45         <tr>
46           <th>#</th>
47           <th>Nick</th>
48           <th>Elo</th>
49         </tr>
50       </thead>
51       <tbody>
52       <% i = 1 %>
53       % for r in rs:
54         <tr>
55           <td>${i}</td>
56           <td><a href="${request.route_url('player_info', id=r.player_id)}" title="Go to the player info page for this player">${r.nick_html_colors()|n}</a></td>
57           <td>${round(r.elo, 3)}</td>
58         </tr>
59         <% i = i+1 %>
60       % endfor
61       </tbody>
62     </table>
63     <p class="note"><a href="${request.route_url('rank_index', page=1, game_type_cd=rs[0].game_type_cd)}" title="See more ${rs[0].game_type_cd} rankings">More...</a></p>
64   </div> <!-- /span4 -->
65   % endif
66
67 % endfor
68 </div> <!-- row -->
69 % endif
70
71
72 <div class="row">
73   <div class="span4">
74     <h3>Most Active Players</h3>
75     <table class="table table-bordered table-condensed">
76       <thead>
77         <tr>
78           <th>#</th>
79           <th>Nick</th>
80           <th class="play-time">Play Time</th>
81         </tr>
82       </thead>
83       <tbody>
84       <% i = 1 %>
85       % for (player_id, nick, alivetime) in top_players:
86         <tr>
87           <td>${i}</td>
88           % if player_id != '-':
89           <td><a href="${request.route_url('player_info', id=player_id)}" title="Go to the player info page for this player">${nick|n}</a></td>
90           % else:
91           <td>${nick|n}</td>
92           % endif
93           <td class="play-time">${alivetime}</td>
94         </tr>
95         <% i = i+1 %>
96       % endfor
97       </tbody>
98     </table>
99     <p class="note">*Most active stats are from the past 7 days</p>
100   </div> <!-- /span4 -->
101
102   <div class="span4">
103     <h3>Most Active Servers</h3>
104     <table class="table table-bordered table-condensed">
105       <thead>
106         <tr>
107           <th>#</th>
108           <th>Server</th>
109           <th>Games</th>
110         </tr>
111       </thead>
112       <tbody>
113       <% i = 1 %>
114       % for (server_id, name, count) in top_servers:
115         <tr>
116           <td>${i}</td>
117           % if server_id != '-':
118           <td><a href="${request.route_url('server_info', id=server_id)}" title="Go to the server info page for ${name}">${name}</a></td>
119           % else:
120           <td>${name}</td>
121           % endif
122           <td>${count}</td>
123         </tr>
124         <% i = i+1 %>
125       % endfor
126       </tbody>
127     </table>
128   </div> <!-- /span4 -->
129
130   <div class="span4">
131     <h3>Most Active Maps</h3>
132     <table class="table table-bordered table-condensed">
133       <thead>
134         <tr>
135           <th>#</th>
136           <th>Map</th>
137           <th>Games</th>
138         </tr>
139       </thead>
140       <tbody>
141       <% i = 1 %>
142       % for (map_id, name, count) in top_maps:
143         <tr>
144           <td>${i}</td>
145           % if map_id != '-':
146           <td><a href="${request.route_url('map_info', id=map_id)}" title="Go to the map info page for ${name}">${name}</a></td>
147           % else:
148           <td>${name}</td>
149           % endif
150           <td>${count}</td>
151         </tr>
152         <% i = i+1 %>
153       % endfor
154       </tbody>
155     </table>
156   </div> <!-- /span4 -->
157 </div> <!-- /row -->
158
159 % if len(recent_games) > 0:
160 <div class="row">
161   <div class="span12">
162     <h3>Recent Games</h3>
163     <table class="table table-bordered table-condensed">
164       <thead>
165         <tr>
166           <th></th>
167           <th>Type</th>
168           <th>Server</th>
169           <th>Map</th>
170           <th>Time</th>
171           <th>Winner</th>
172         </tr>
173       </thead>
174       <tbody>
175       % for rg in recent_games:
176         <tr>
177           <td><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>
178           <!-- <td class="gt_icon"><img title="${rg.game_type_cd}" src="/static/images/icons/24x24/${rg.game_type_cd}.png" alt="${rg.game_type_cd}" /></td> -->
179           <td><span class="sprite sprite-${rg.game_type_cd}" title="${rg.game_type_cd}"></span></td>
180           <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>
181           <td><a href="${request.route_url('map_info', id=rg.map_id)}" title="Go to the map detail page for this map">${rg.map_name}</a></td>
182           <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>
183           <td>
184             % if rg.player_id > 2:
185             <a href="${request.route_url('player_info', id=rg.player_id)}" title="Go to the player info page for this player">${rg.nick_html_colors|n}</a></td>
186             % else:
187             ${rg.nick_html_colors|n}</td>
188             % endif
189         </tr>
190         % endfor
191         </tbody>
192     </table>
193   </div> <!-- /span12 -->
194 </div> <!-- /row -->
195 % endif