Mormegil has uploaded a new change for review.
https://gerrit.wikimedia.org/r/161762
Change subject: Fix special case at Special:MediaStatistics
......................................................................
Fix special case at Special:MediaStatistics
When a percentage was equal to 100 %, makePercentPretty
determined it should have zero decimal places, and the
resulting string "100" had "trailing 0's" removed, resulting
in a completely wrong "1".
We might either check if the number contains the decimal dot
prior to trimming, or spare the hassle for the special case
completely.
Change-Id: I15ac5caa275d72909adba27b6b88824a830bd574
---
M includes/specials/SpecialMediaStatistics.php
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/62/161762/1
diff --git a/includes/specials/SpecialMediaStatistics.php
b/includes/specials/SpecialMediaStatistics.php
index 681c332..3fd84138e 100644
--- a/includes/specials/SpecialMediaStatistics.php
+++ b/includes/specials/SpecialMediaStatistics.php
@@ -185,6 +185,9 @@
if ( $decimal == 0 ) {
return '0';
}
+ if ( $decimal >= 100 ) {
+ return '100';
+ }
$percent = sprintf( "%." . max( 0, 2 - floor( log10( $decimal )
) ) . "f", $decimal );
// Then remove any trailing 0's
return preg_replace( '/\.?0*$/', '', $percent );
--
To view, visit https://gerrit.wikimedia.org/r/161762
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I15ac5caa275d72909adba27b6b88824a830bd574
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Mormegil <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits