Nikerabbit has uploaded a new change for review.

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


Change subject: Fix --most reports
......................................................................

Fix --most reports

Change-Id: Ib80d05d587db0aef2b22d32106d9a2a173cf6213
---
M scripts/groupStatistics.php
1 file changed, 12 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate 
refs/changes/05/96505/1

diff --git a/scripts/groupStatistics.php b/scripts/groupStatistics.php
index 258b29b..1bfcb72 100644
--- a/scripts/groupStatistics.php
+++ b/scripts/groupStatistics.php
@@ -300,10 +300,10 @@
                // Check if score should be reported and prepare weights
                $most = $this->getOption( 'most' );
                $weights = array();
-               if ( $most && isset( $localisedWeights[$most] ) ) {
+               if ( $most && isset( $this->localisedWeights[$most] ) ) {
                        $reportScore = true;
 
-                       foreach ( $localisedWeights[$most] as $weight ) {
+                       foreach ( $this->localisedWeights[$most] as $weight ) {
                                $weights[] = $weight;
                        }
                }
@@ -316,16 +316,16 @@
                        $l10n = true;
                }
 
-               $wmfscore = $this->hasOption( 'wmfscore ' );
+               $wmfscore = $this->hasOption( 'wmfscore' );
 
                // Get groups from input
                $groups = array();
                if ( $reportScore ) {
                        $reqGroups = array_keys( $this->localisedWeights[$most] 
);
-               } elseif ( !$wmfscore ) {
-                       $reqGroups = array_map( 'trim', explode( ',', 
$this->getOption( 'groups' ) ) );
-               } else {
+               } elseif ( $wmfscore ) {
                        $reqGroups = array_keys( 
$this->localisedWeights['wikimedia'] );
+               } else {
+                       $reqGroups = array_map( 'trim', explode( ',', 
$this->getOption( 'groups' ) ) );
                }
 
                // List of all groups
@@ -448,12 +448,12 @@
                                }
 
                                // Do not calculate if we do not need it for 
anything.
-                               if ( $wmfscore && isset( 
$wikimediaCodeMap[$code] ) && $wikimediaCodeMap[$code] == '' ) {
+                               if ( $wmfscore && isset( 
$this->wikimediaCodeMap[$code] ) && $this->wikimediaCodeMap[$code] == '' ) {
                                        continue;
                                }
 
                                // If --most is set, skip all other
-                               if ( $most && !isset( 
$mostSpokenLanguages[$code] ) ) {
+                               if ( $most && !isset( 
$this->mostSpokenLanguages[$code] ) ) {
                                        continue;
                                }
 
@@ -485,12 +485,12 @@
                        }
 
                        // Skip unneeded
-                       if ( $wmfscore && isset( $wikimediaCodeMap[$code] ) && 
$wikimediaCodeMap[$code] == '' ) {
+                       if ( $wmfscore && isset( $this->wikimediaCodeMap[$code] 
) && $this->wikimediaCodeMap[$code] == '' ) {
                                continue;
                        }
 
                        // If --most is set, skip all other
-                       if ( $most && !isset( $mostSpokenLanguages[$code] ) ) {
+                       if ( $most && !isset( $this->mostSpokenLanguages[$code] 
) ) {
                                continue;
                        }
 
@@ -582,8 +582,8 @@
                                        // Multiple variants can be used for 
the same wiki.
                                        // Store the scores in an array and 
output them later
                                        // when they can be averaged.
-                                       if ( isset( $wikimediaCodeMap[$code] ) 
) {
-                                               $wmfcode = 
$wikimediaCodeMap[$code];
+                                       if ( isset( 
$this->wikimediaCodeMap[$code] ) ) {
+                                               $wmfcode = 
$this->wikimediaCodeMap[$code];
                                        } else {
                                                $codeparts = explode( '-', 
$code );
                                                $wmfcode = $codeparts[0];

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib80d05d587db0aef2b22d32106d9a2a173cf6213
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>

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

Reply via email to