mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 00:35:30 +00:00
significant rounding errors in poll results
This commit is contained in:
parent
105d57b1a4
commit
b3d781bec3
1 changed files with 6 additions and 6 deletions
|
@ -2007,7 +2007,7 @@ function format_poll($item, $s, $opts)
|
|||
if ($activated && $commentable) {
|
||||
$output .= '<input type="checkbox" name="answer[]" value="' . htmlspecialchars($text) . '"> <strong>' . $text . '</strong>' . EOL;
|
||||
$output .= '<div class="progress bg-opacity-25" style="height: 3px; max-width: 75%;">';
|
||||
$output .= '<div class="progress-bar bg-default" 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-default" 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) . '</small></div>';
|
||||
|
@ -2015,7 +2015,7 @@ function format_poll($item, $s, $opts)
|
|||
} else {
|
||||
$output .= '<input type="checkbox" name="answer[]" value="' . htmlspecialchars($text) . '" disabled="disabled"> <strong>' . $text . '</strong>' . EOL;
|
||||
$output .= '<div class="progress bg-opacity-25" style="height: 3px; max-width: 75%;">';
|
||||
$output .= '<div class="progress-bar bg-default" 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-default" 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) . '</small></div>';
|
||||
$output .= EOL;
|
||||
|
@ -2042,17 +2042,17 @@ function format_poll($item, $s, $opts)
|
|||
|
||||
$output .= '<input type="radio" name="answer" value="' . htmlspecialchars($text) . '"> <strong>' . $text . '</strong>' . EOL;
|
||||
$output .= '<div class="progress bg-opacity-25" style="height: 3px; max-width: 75%;">';
|
||||
$output .= '<div class="progress-bar bg-default" 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-default" 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-opacity-25" style="height: 3px;">';
|
||||
$output .= '<div class="progress-bar bg-default" 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-default" 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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue