add jumlah undian
This commit is contained in:
@@ -28,6 +28,11 @@
|
||||
<td>{{ no_vote.name }}</td>
|
||||
<td>{{ no_vote.unit }}</td>
|
||||
<td>0</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><b>Jumlah Undian</b></td>
|
||||
<td><b>{{ calculateTotalVotes(position.id) }}</b></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -73,6 +78,12 @@ export default {
|
||||
.reduce((total, result) => total + result.votes, 0);
|
||||
|
||||
return ((votes / totalVotes) * 100).toFixed(2);
|
||||
},
|
||||
|
||||
calculateTotalVotes(positionId) {
|
||||
return this.results
|
||||
.filter(result => result.position_id === positionId)
|
||||
.reduce((total, result) => total + result.votes, 0);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user