Wikinaut has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/66229


Change subject: fixed a problem with fractional percentages
......................................................................

fixed a problem with fractional percentages

when rendering the result bar do not use localized percentage string
width must contain a dot like 33.33% but must not come with a comma like 33,33%

Change-Id: Id2dd68cb8df339358b274df08d713eee351adf42
---
M AJAXPoll.php
M AJAXPoll_body.php
2 files changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AJAXPoll 
refs/changes/29/66229/1

diff --git a/AJAXPoll.php b/AJAXPoll.php
index ac9918a..f84287d 100644
--- a/AJAXPoll.php
+++ b/AJAXPoll.php
@@ -31,7 +31,7 @@
 $wgExtensionCredits['parserhook'][] = array(
        'path' => __FILE__,
        'name' => 'AJAX Poll',
-       'version' => '1.81 20130526',
+       'version' => '1.82 20130531',
        'author' => array( 'Dariusz Siedlecki', 'Jack Phoenix', 'Thomas Gries' 
),
        'descriptionmsg' => 'ajaxpoll-desc',
        'url' => 'https://www.mediawiki.org/wiki/Extension:AJAX_Poll',
diff --git a/AJAXPoll_body.php b/AJAXPoll_body.php
index d5ce3d7..07ef53e 100644
--- a/AJAXPoll_body.php
+++ b/AJAXPoll_body.php
@@ -402,7 +402,8 @@
                                if ( $amountOfVotes == 0 ) {
                                        $percent = 0;
                                } else {
-                                       $percent = $wgLang->formatNum( round( ( 
isset( $poll_result[$i + 1] ) ? $poll_result[$i + 1] : 0 ) * 100 / 
$amountOfVotes, 2 ) );
+                                       $percent = round( ( isset( 
$poll_result[$i + 1] ) ? $poll_result[$i + 1] : 0 ) * 100 / $amountOfVotes, 2 );
+                                       $percentLocalized = $wgLang->formatNum( 
$percent );
                                }
 
                                $our = ( isset( $row[0] ) && ( $row[0] - 1 == 
$i ) );
@@ -414,8 +415,8 @@
                                if ( $wgUser->isAllowed( 
'ajaxpoll-view-results' )
                                        && ( $showResultsBeforeVoting || ( 
!$showResultsBeforeVoting && $userVoted ) ) ) {
                                        $resultBar = "<div 
class='ajaxpoll-answer-vote" . ( $our ? ' ajaxpoll-our-vote' : '' ) ."'>
-<span title='" . wfMessage( 'ajaxpoll-percent-votes', sprintf( $percent ) 
)->escaped() . "'>" . ( ( isset( $poll_result ) && !empty( $poll_result[$i + 1] 
) ) ? $poll_result[$i + 1] : 0 ) . "</span>
-<div style='width: " . $percent . "%;" . ( $percent == 0 ? ' border:0;' : '' ) 
. "'></div>
+<span title='" . wfMessage( 'ajaxpoll-percent-votes', sprintf( 
$percentLocalized ) )->escaped() . "'>" . ( ( isset( $poll_result ) && !empty( 
$poll_result[$i + 1] ) ) ? $poll_result[$i + 1] : 0 ) . "</span>
+<div style='width:" . $percent . "%;" . ( $percent == 0 ? ' border:0;' : '' ) 
. "'></div>
 </div>";
                                } else {
                                        $resultBar = '';

-- 
To view, visit https://gerrit.wikimedia.org/r/66229
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id2dd68cb8df339358b274df08d713eee351adf42
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AJAXPoll
Gerrit-Branch: master
Gerrit-Owner: Wikinaut <m...@tgries.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to