Awight has uploaded a new change for review.

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

Change subject: minor fixups to WIP
......................................................................

minor fixups to WIP

Change-Id: I74a4e50256b955de2ec13a7a6e7dbce375ea4c04
---
M includes/BannerAllocationCalculator.php
M includes/BannerChoiceDataProvider.php
2 files changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice 
refs/changes/57/172957/1

diff --git a/includes/BannerAllocationCalculator.php 
b/includes/BannerAllocationCalculator.php
index e130459..2ff8edd 100644
--- a/includes/BannerAllocationCalculator.php
+++ b/includes/BannerAllocationCalculator.php
@@ -88,6 +88,8 @@
                                $banner['allocation'] = 
$banner['max_allocation'] * $scaling;
                        }
                }
+
+               return $banners;
        }
 
        /**
@@ -101,7 +103,7 @@
         * @return array banners with properties suitable for 
         *   @see BannerAllocationCalculator::calculateAllocations
         */
-       function filterAndTransformBanners( $campaigns, $device, $bucket ) {
+       static function filterAndTransformBanners( $campaigns, $device, $bucket 
) {
                $banners = array();
                foreach( $campaigns as $campaign ) {
                        foreach ( $campaign['banners'] as $banner ) {
diff --git a/includes/BannerChoiceDataProvider.php 
b/includes/BannerChoiceDataProvider.php
index 65553a0..5c84f46 100644
--- a/includes/BannerChoiceDataProvider.php
+++ b/includes/BannerChoiceDataProvider.php
@@ -310,11 +310,13 @@
                $choices = $this->getChoices();
 
                // Remove campaigns that are geotargetted but not to selected 
country
+               $out = array();
                foreach( $choices as $index => $campaign ) {
                        if ( $campaign['geotargetted'] && !in_array( $country, 
$campaign['countries'] ) ) {
-                               unset( $choices[$index] );
+                               continue;
                        }
+                       $out[$index] = $campaign;
                }
-               return $choices;
+               return $out;
        }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I74a4e50256b955de2ec13a7a6e7dbce375ea4c04
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Awight <[email protected]>

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

Reply via email to