]> de.git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/templates/frag_matrix.mako
If no frag matrix row is found, show zeros.
[xonotic/xonstat.git] / xonstat / templates / frag_matrix.mako
1 <%def name="frag_matrix(pgstats, matrix_by_pgstat_id)">
2
3 ## Displays a frag matrix table, in scoreboardpos order from top to bottom and left to right
4
5 <table>
6   <thead>
7     <th></th>
8     % for pgstat in pgstats:
9     <th><span class="rotated">${pgstat.nick_html_colors()|n}</span></th>
10     % endfor
11   </thead>
12
13   % for fragger in pgstats:
14   <tr>
15     <td class="bg">${fragger.nick_html_colors()|n}</td>
16     % for victim in pgstats:
17     <%
18       pgfm = matrix_by_pgstat_id.get(fragger.player_game_stat_id)
19
20       victim_pgfm = matrix_by_pgstat_id.get(victim.player_game_stat_id)
21       if victim_pgfm:
22         victim_index = str(victim_pgfm.player_index)
23       else:
24         victim_index = "-1"
25     %>
26
27     % if pgfm:
28     <td>${pgfm.matrix.get(victim_index, 0)}</td>
29     % else:
30     <td>0</td>
31     % endif
32     % endfor
33   </tr>
34   % endfor
35 </table>
36
37 </%def>