mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
tu_details.php: Avoid inline computations
Compute the total number of votes and the participation at the beginning of the template instead of doing it inside the template itself. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
d41e40d9d6
commit
481ff2335c
1 changed files with 15 additions and 6 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
<?php
|
||||||
|
$yes = $row["Yes"];
|
||||||
|
$no = $row["No"];
|
||||||
|
$abstain = $row["Abstain"];
|
||||||
|
$active_tus = $row["ActiveTUs"];
|
||||||
|
|
||||||
|
$total = $yes + $no + $abstain;
|
||||||
|
$participation = $total / $active_tus;
|
||||||
|
?>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<h2><?= __("Proposal Details") ?></h2>
|
<h2><?= __("Proposal Details") ?></h2>
|
||||||
|
|
||||||
|
@ -37,10 +46,10 @@
|
||||||
<th><?= __('Participation') ?></th>
|
<th><?= __('Participation') ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= $row['Yes'] ?></td>
|
<td><?= $yes ?></td>
|
||||||
<td><?= $row['No'] ?></td>
|
<td><?= $no ?></td>
|
||||||
<td><?= $row['Abstain'] ?></td>
|
<td><?= $abstain ?></td>
|
||||||
<td><?= ($row['Yes'] + $row['No'] + $row['Abstain']) ?></td>
|
<td><?= $total ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php if ($hasvoted == 0): ?>
|
<?php if ($hasvoted == 0): ?>
|
||||||
<span style="color: red; font-weight: bold"><?= __("No") ?></span>
|
<span style="color: red; font-weight: bold"><?= __("No") ?></span>
|
||||||
|
@ -48,8 +57,8 @@
|
||||||
<span style="color: green; font-weight: bold"><?= __("Yes") ?></span>
|
<span style="color: green; font-weight: bold"><?= __("Yes") ?></span>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
<?php if ($row['ActiveTUs'] > 0): ?>
|
<?php if ($active_tus > 0): ?>
|
||||||
<td><?= number_format(($row['Yes'] + $row['No'] + $row['Abstain']) / $row['ActiveTUs'] * 100, 2) ?>%</td>
|
<td><?= number_format($participation * 100, 2) ?>%</td>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<td><?= __("unknown") ?></td>
|
<td><?= __("unknown") ?></td>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
Loading…
Add table
Reference in a new issue