jenkins-bot has submitted this change and it was merged.

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


Fix --most reports

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

Approvals:
  Siebrand: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/scripts/groupStatistics.php b/scripts/groupStatistics.php
index 258b29b..cede5f1 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,14 @@
                                }
 
                                // 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 +487,14 @@
                        }
 
                        // 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 +586,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: merged
Gerrit-Change-Id: Ib80d05d587db0aef2b22d32106d9a2a173cf6213
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to