diff --git a/views/results.php b/views/results.php index 96453dd..bc1e9a0 100644 --- a/views/results.php +++ b/views/results.php @@ -12,7 +12,7 @@ foreach ($poll->options as $option) votes ?> label ?> - votes / $total_votes, 3)*100 ?>% + votes / $total_votes, 3)*100 ?>% diff --git a/views/svg/results.php b/views/svg/results.php index 047dfa7..4f2a14b 100644 --- a/views/svg/results.php +++ b/views/svg/results.php @@ -9,7 +9,7 @@ foreach ($poll->options as $option) $options_percentages = []; foreach ($poll->options as $option) - $options_percentages[] = $option->votes / $total_votes; + $options_percentages[] = ($total_votes == 0) ? 0 : $option->votes / $total_votes; function percentage_pos_x($r, $percentage) { return round($r * sin(2 * M_PI * $percentage), 2); }