diff --git a/app/classes/Framadate/Repositories/RepositoryFactory.php b/app/classes/Framadate/Repositories/RepositoryFactory.php
index 1ebef18ebe26669c2f35bcd0e025462b10a48219..810d3912d9b9284cb06c66daa44e27eca9d4a2f8 100644
--- a/app/classes/Framadate/Repositories/RepositoryFactory.php
+++ b/app/classes/Framadate/Repositories/RepositoryFactory.php
@@ -4,16 +4,16 @@
  * is not distributed with this file, you can obtain one at
  * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt
  *
- * Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ
+ * Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ
  * Authors of Framadate/OpenSondage: Framasoft (https://github.com/framasoft)
  *
  * =============================
  *
- * Ce logiciel est régi par la licence CeCILL-B. Si une copie de cette licence
+ * Ce logiciel est régi par la licence CeCILL-B. Si une copie de cette licence
  * ne se trouve pas avec ce fichier vous pouvez l'obtenir sur
  * http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt
  *
- * Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ
+ * Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ
  * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
  */
 namespace Framadate\Repositories;
diff --git a/app/classes/Framadate/Services/PollService.php b/app/classes/Framadate/Services/PollService.php
index 05e326c038942cb69d8be12b95c2cddc62905323..a01e683674384620fdad1be58d4eeea63a6af0ae 100644
--- a/app/classes/Framadate/Services/PollService.php
+++ b/app/classes/Framadate/Services/PollService.php
@@ -25,7 +25,6 @@ use Framadate\Form;
 use Framadate\FramaDB;
 use Framadate\Repositories\RepositoryFactory;
 use Framadate\Security\Token;
-use Framadate\Utils;
 
 class PollService {
     private $connect;
@@ -178,49 +177,64 @@ class PollService {
         return $this->pollRepository->findAllByAdminMail($mail);
     }
 
-    function computeBestChoices($votes, $poll) {
+    /**
+     * @param \stdClass $poll
+     * @return array
+     */
+    private function computeEmptyBestChoices($poll)
+    {
         $result = ['y' => [], 'inb' => []];
-        
-        if (0 === count($votes)) {
-            // if there is no votes, calculates the number of slot
-            
-            $slots = $this->allSlotsByPoll($poll);
-            
-            if ($poll->format === 'A') {
-                // poll format classic
-                
-                foreach ($slots as $slot) {
+        // if there is no votes, calculates the number of slot
+
+        $slots = $this->allSlotsByPoll($poll);
+
+        if ($poll->format === 'A') {
+            // poll format classic
+
+            for ($i = 0; $i < count($slots); $i++) {
+                $result['y'][] = 0;
+                $result['inb'][] = 0;
+            }
+        } else {
+            // poll format date
+
+            $slots = $this->splitSlots($slots);
+
+            foreach ($slots as $slot) {
+                for ($i = 0; $i < count($slot->moments); $i++) {
                     $result['y'][] = 0;
                     $result['inb'][] = 0;
                 }
-            } else {
-                // poll format date
-                
-                $slots = $this->splitSlots($slots);
-                
-                foreach ($slots as $slot) {
-                    foreach ($slot->moments as $_) {
-                        $result['y'][] = 0;
-                        $result['inb'][] = 0;
-                    }
-                }
             }
-        } else {
-            // if there is votes
-            
-            foreach ($votes as $vote) {
-                $choices = str_split($vote->choices);
-                foreach ($choices as $i => $choice) {
-                    if (!isset($result['y'][$i])) {
-                        $result['inb'][$i] = 0;
-                        $result['y'][$i] = 0;
-                    }
-                    if ($choice === "1") {
-                        $result['inb'][$i]++;
-                    }
-                    if ($choice === "2") {
-                        $result['y'][$i]++;
-                    }
+        }
+        return $result;
+    }
+
+    /**
+     * @param array $votes
+     * @param \stdClass $poll
+     * @return array
+     */
+    public function computeBestChoices($votes, $poll) {
+
+        if (0 === count($votes)) {
+           return $this->computeEmptyBestChoices($poll);
+        }
+        $result = ['y' => [], 'inb' => []];
+
+        // if there are votes
+        foreach ($votes as $vote) {
+            $choices = str_split($vote->choices);
+            foreach ($choices as $i => $choice) {
+                if (!isset($result['y'][$i])) {
+                    $result['inb'][$i] = 0;
+                    $result['y'][$i] = 0;
+                }
+                if ($choice === "1") {
+                    $result['inb'][$i]++;
+                }
+                if ($choice === "2") {
+                    $result['y'][$i]++;
                 }
             }
         }