This adds an field that indicates whether the vote was accepted or
rejected, based on the rules specified in the TU Bylaws.

Signed-off-by: Lukas Fleischer <[email protected]>
---
 web/template/tu_details.php | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/web/template/tu_details.php b/web/template/tu_details.php
index 61abab7..c09e30c 100644
--- a/web/template/tu_details.php
+++ b/web/template/tu_details.php
@@ -3,9 +3,18 @@ $yes = $row["Yes"];
 $no = $row["No"];
 $abstain = $row["Abstain"];
 $active_tus = $row["ActiveTUs"];
+$quorum = $row["Quorum"];
 
 $total = $yes + $no + $abstain;
 $participation = $total / $active_tus;
+
+if ($yes > $active_tus / 2) {
+       $vote_accepted = true;
+} elseif ($participation > $quorum && $yes > $no) {
+       $vote_accepted = true;
+} else {
+       $vote_accepted = false;
+}
 ?>
 <div class="box">
        <h2><?= __("Proposal Details") ?></h2>
@@ -30,6 +39,17 @@ $participation = $total / $active_tus;
                <br />
                <?= __("End") ?>:
                <strong><?= gmdate("Y-m-d H:i", $row['End']) ?></strong>
+               <?php if ($isrunning == 0): ?>
+               <br />
+               <?= __("Result") ?>:
+               <?php if (!$quorum): ?>
+               <span><?= __("unknown") ?></span>
+               <?php elseif ($vote_accepted): ?>
+               <span style="color: green; font-weight: bold"><?= 
__("Accepted") ?></span>
+               <?php else: ?>
+               <span style="color: red; font-weight: bold"><?= __("Rejected") 
?></span>
+               <?php endif; ?>
+               <?php endif; ?>
        </p>
 
        <p>
-- 
1.8.4.rc1.383.g13e9f3f

Reply via email to