From 76b19ee9ba5557b746bfe3ef47349aeb2026df3c Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 20 Feb 2018 15:17:14 +0100 Subject: [PATCH] fix votes wrongly calculated because of type check Signed-off-by: Thomas Citharel --- app/classes/Framadate/Services/PollService.php | 6 +++--- tpl/part/vote_table_classic.tpl | 2 +- tpl/part/vote_table_date.tpl | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/classes/Framadate/Services/PollService.php b/app/classes/Framadate/Services/PollService.php index 43efd42..c36c55c 100644 --- a/app/classes/Framadate/Services/PollService.php +++ b/app/classes/Framadate/Services/PollService.php @@ -113,7 +113,7 @@ class PollService { function addComment($poll_id, $name, $comment) { if ($this->commentRepository->exists($poll_id, $name, $comment)) { return true; - } + } return $this->commentRepository->insert($poll_id, $name, $comment); } @@ -160,10 +160,10 @@ class PollService { $result['inb'][$i] = 0; $result['y'][$i] = 0; } - if ($choice === 1) { + if ($choice === "1") { $result['inb'][$i]++; } - if ($choice === 2) { + if ($choice === "2") { $result['y'][$i]++; } } diff --git a/tpl/part/vote_table_classic.tpl b/tpl/part/vote_table_classic.tpl index 6ebed25..5f4a155 100644 --- a/tpl/part/vote_table_classic.tpl +++ b/tpl/part/vote_table_classic.tpl @@ -190,7 +190,7 @@ {$i = $i+1} - + {/foreach} diff --git a/tpl/part/vote_table_date.tpl b/tpl/part/vote_table_date.tpl index 2494be2..4366895 100644 --- a/tpl/part/vote_table_date.tpl +++ b/tpl/part/vote_table_date.tpl @@ -219,17 +219,17 @@ - - + + {$i = 0} - {foreach $slots as $slot} + {foreach $slots as $slot} {foreach $slot->moments as $moment} - + - + {$i = $i+1} {/foreach}