1 <%def name="accuracy(weapon_stats)">
4 ## weapon_stats is an array containing what we'll call "weapon_stat"
5 ## objects. These objects have the following attributes:
7 ## [0] = Weapon description
15 <table class="table-hover table-condensed">
17 <th class="small-1"></th>
18 <th class="show-for-medium-up">Weapon</th>
19 <th class="show-for-medium-up">Frags</th>
26 for weapon_stat in weapon_stats:
27 total_damage += weapon_stat[2]
32 % for weapon_stat in weapon_stats:
34 if weapon_stat[3] > 0:
35 damage_pct = round(float(weapon_stat[2])/weapon_stat[3]*100, 2)
39 if weapon_stat[5] > 0:
40 hit_pct = round(float(weapon_stat[4])/weapon_stat[5]*100, 2)
45 ## Note: the name of the image must match up with the weapon_cd
46 ## entry of that weapon, else this won't work
47 <td class="small-1 text-center"><span class="sprite sprite-${weapon_stat[1]}"></span></td>
48 <td class="show-for-medium-up">${weapon_stat[0]}</td>
49 <td class="show-for-medium-up">${weapon_stat[6]}</td>
50 <td>${weapon_stat[4]}/${weapon_stat[5]} (${hit_pct}%)</td>
51 <td>${weapon_stat[2]} (${round(float(weapon_stat[2])/total_damage*100, 2)}%)</td>