<%inherit file="local:templates.master"/>
##
<%!
from bazbase.conversion import render, to_python

def name_for(pc):
    f = render(pc, u'name', filters={'let': {u'gender': u'F'}})
    m = render(pc, u'name', filters={'let': {u'gender': u'M'}})
    if f != m:
        return '%s/%s' % (f, m)
    else:
        return f

def prop_for_run(pc, prop, run):
    return render(pc, prop,
                  filters={'let': {u'run': render(run, u'identifier')}})
%>
##
<%def name="pc_table()">
<table>
<thead>
<tr>
<th>Macro</th>
<th>Name (F/M)</th>
%for r in runs:
<th colspan="2">${render(r, u'name')}</th>
%endfor
</tr>
</thead>
<tbody>
%for pc in pcs:
<tr>
<th>${pc.ename}</th>
<td>${name_for(pc)}</td>
%for r in runs:
<td>${prop_for_run(pc, u'player', r)}</td>
<td>${prop_for_run(pc, u'gender', r)}</td>
%endfor
</tr>
%endfor
</tbody>
<tfoot>
<tr><th>Characters</th><td>(Uncast/Total)</td>
%for r in runs:
<td colspan="2">0/${len(pcs)}</td>
%endfor
</tr>
<tr><th>Players Available</th><td>(Uncast/Total)</td>
%for r in runs:
<td colspan="2">
  0/${sum(1 for a in apps if r in to_python(a, u'availability'))}
</td>
%endfor
</tr>
</tfoot>
</table>
</%def>
##
${next.body()}
