diff options
author | Mario <mario@mariovavti.com> | 2023-04-19 11:01:49 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-04-19 11:01:49 +0000 |
commit | d7c479fa6d8e9297a23017c60788c918208cfd9d (patch) | |
tree | 5513bc434e36bd736bf845f5bc5e8e6f4048ad70 | |
parent | 44e5dc7d97a7751c5fc44cf73e0c8cb26c2a0bbd (diff) | |
download | volse-hubzilla-d7c479fa6d8e9297a23017c60788c918208cfd9d.tar.gz volse-hubzilla-d7c479fa6d8e9297a23017c60788c918208cfd9d.tar.bz2 volse-hubzilla-d7c479fa6d8e9297a23017c60788c918208cfd9d.zip |
% values in format_poll() should be rounded
-rw-r--r-- | include/text.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/include/text.php b/include/text.php index f1a7f5fbf..13b385e98 100644 --- a/include/text.php +++ b/include/text.php @@ -1929,18 +1929,18 @@ function format_poll($item,$s,$opts) { $output .= '<input type="checkbox" name="answer[]" value="' . htmlspecialchars($text) . '"> <strong>' . $text . '</strong>' . EOL; $output .= '<div class="progress bg-secondary bg-opacity-25" style="height: 3px;">'; - $output .= '<div class="progress-bar bg-info" role="progressbar" style="width: ' . (($totalResponses) ? intval($total / $totalResponses * 100) : 0). '%;" aria-valuenow="" aria-valuemin="0" aria-valuemax="100"></div>'; + $output .= '<div class="progress-bar bg-info" role="progressbar" style="width: ' . (($totalResponses) ? round($total / $totalResponses * 100) : 0). '%;" aria-valuenow="" aria-valuemin="0" aria-valuemax="100"></div>'; $output .= '</div>'; - $output .= '<div class="text-muted"><small>' . sprintf(tt('%d Vote', '%d Votes', $total, 'noun'), $total) . ' | ' . (($totalResponses) ? intval($total / $totalResponses * 100) . '%' : '0%') . '</small></div>'; + $output .= '<div class="text-muted"><small>' . sprintf(tt('%d Vote', '%d Votes', $total, 'noun'), $total) . ' | ' . (($totalResponses) ? round($total / $totalResponses * 100) . '%' : '0%') . '</small></div>'; $output .= EOL; } else { //$output .= '[ ] ' . $text . ' (' . $total . ')' . EOL; $output .= '<input type="checkbox" name="answer[]" value="' . htmlspecialchars($text) . '" disabled="disabled"> <strong>' . $text . '</strong>' . EOL; $output .= '<div class="progress bg-secondary bg-opacity-25" style="height: 3px;">'; - $output .= '<div class="progress-bar bg-info" role="progressbar" style="width: ' . (($totalResponses) ? intval($total / $totalResponses * 100) : 0) . '%;" aria-valuenow="" aria-valuemin="0" aria-valuemax="100"></div>'; + $output .= '<div class="progress-bar bg-info" role="progressbar" style="width: ' . (($totalResponses) ? round($total / $totalResponses * 100) : 0) . '%;" aria-valuenow="" aria-valuemin="0" aria-valuemax="100"></div>'; $output .= '</div>'; - $output .= '<div class="text-muted"><small>' . sprintf(tt('%d Vote', '%d Votes', $total, 'noun'), $total) . ' | ' . (($totalResponses) ? intval($total / $totalResponses * 100) . '%' : '0%') . '</small></div>'; + $output .= '<div class="text-muted"><small>' . sprintf(tt('%d Vote', '%d Votes', $total, 'noun'), $total) . ' | ' . (($totalResponses) ? round($total / $totalResponses * 100) . '%' : '0%') . '</small></div>'; $output .= EOL; } } @@ -1965,18 +1965,18 @@ function format_poll($item,$s,$opts) { if ($activated && $commentable) { $output .= '<input type="radio" name="answer" value="' . htmlspecialchars($text) . '"> <strong>' . $text . '</strong>' . EOL; $output .= '<div class="progress bg-secondary bg-opacity-25" style="height: 3px;">'; - $output .= '<div class="progress-bar bg-info" role="progressbar" style="width: ' . (($totalResponses) ? intval($total / $totalResponses * 100) : 0). '%;" aria-valuenow="" aria-valuemin="0" aria-valuemax="100"></div>'; + $output .= '<div class="progress-bar bg-info" role="progressbar" style="width: ' . (($totalResponses) ? round($total / $totalResponses * 100) : 0). '%;" aria-valuenow="" aria-valuemin="0" aria-valuemax="100"></div>'; $output .= '</div>'; - $output .= '<div class="text-muted"><small>' . sprintf(tt('%d Vote', '%d Votes', $total, 'noun'), $total) . ' | ' . (($totalResponses) ? intval($total / $totalResponses * 100) . '%' : '0%') . '</small></div>'; + $output .= '<div class="text-muted"><small>' . sprintf(tt('%d Vote', '%d Votes', $total, 'noun'), $total) . ' | ' . (($totalResponses) ? round($total / $totalResponses * 100) . '%' : '0%') . '</small></div>'; $output .= EOL; } else { $output .= '<input type="radio" name="answer" value="' . htmlspecialchars($text) . '" disabled="disabled"> <strong>' . $text . '</strong>' . EOL; $output .= '<div class="progress bg-secondary bg-opacity-25" style="height: 3px;">'; - $output .= '<div class="progress-bar bg-info" role="progressbar" style="width: ' . (($totalResponses) ? intval($total / $totalResponses * 100) : 0) . '%;" aria-valuenow="" aria-valuemin="0" aria-valuemax="100"></div>'; + $output .= '<div class="progress-bar bg-info" role="progressbar" style="width: ' . (($totalResponses) ? round($total / $totalResponses * 100) : 0) . '%;" aria-valuenow="" aria-valuemin="0" aria-valuemax="100"></div>'; $output .= '</div>'; - $output .= '<div class="text-muted"><small>' . sprintf(tt('%d Vote', '%d Votes', $total, 'noun'), $total) . ' | ' . (($totalResponses) ? intval($total / $totalResponses * 100) . '%' : '0%') . '</small></div>'; + $output .= '<div class="text-muted"><small>' . sprintf(tt('%d Vote', '%d Votes', $total, 'noun'), $total) . ' | ' . (($totalResponses) ? round($total / $totalResponses * 100) . '%' : '0%') . '</small></div>'; $output .= EOL; } } |