I have this code from a qweb html report. Please look at the bold segments.
<table class="table-condensed" style="font-size: 10px; width:100%">
<thead>
<tr>
<th style="border: 1px solid black;background-color:black;color:white;">
Student Name
</th>
<th t-foreach="o.batch_att_sheets" t-as="sheet" style="text-align: center; border: 1px solid black;background-color:black;color:white;">
<span t-field="sheet.attend_date" t-field-options="{"format": "d"}"/>
<br/>
<span t-field="sheet.attend_date" t-field-options="{"format": "MMM"}"/>
<br/>
</th>
<th style="border: 1px solid black;background-color:black;color:white;">
Attendance Percentage
</th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.batch_registrations" t-as="line" style="border: 1px solid black;">
<td>
<span t-field="line.student_name"/>
<t t-set="att_counter" t-value="0"/>
</td>
<td t-foreach="o.batch_att_sheets" t-as="sheet" style="text-align: center;border: 1px solid black;">
<t t-set="attended" t-value="o.get_attendance(o.name,line.student_name.id,sheet.name)"/>
<t t-if="attended == 'Y'">
<p>Y</p>
<t t-set="att_counter" t-value="att_counter+1"/>
</t>
<t t-if="attended == 'N'">
<p style="color: red;">
<strong>N</strong>
</p>
</t>
</td>
<td>
<t t-esc="att_counter"/>
</td>
</tr>
</tbody>
</table>
The code is supposed to add 1 to the value of att_counter. However, on the last t-esc I still get a 0. Somehow the value is not persistant after the loop.
Can someone help me?