Livnetata has uploaded a new change for review.

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

Change subject: Fix division by zero
......................................................................

Fix division by zero

An if statement was added to deal with the case where the table is empty.

Change-Id: I7e370034e26b8b5d0eb940712eec149be0b332bb
---
M specials/SpecialContentTranslationStats.php
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/56/167656/1

diff --git a/specials/SpecialContentTranslationStats.php 
b/specials/SpecialContentTranslationStats.php
index 2b73b7f..ec5e23d 100644
--- a/specials/SpecialContentTranslationStats.php
+++ b/specials/SpecialContentTranslationStats.php
@@ -96,7 +96,12 @@
                        implode( "\n", $rows )
                );
 
-               $percentage = round( $main / $total * 100 );
+               if ($total > 0) {
+                       $percentage = round( $main / $total * 100 );
+               } else {
+                       $percentage = 0;
+               }
+               
                $summary = wfMessage( 'cx-stats-summary' )
                        ->numParams( $main, $total, $percentage )
                        ->parse();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e370034e26b8b5d0eb940712eec149be0b332bb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Livnetata <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to