r114564 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114563‎ | r114564 | r114565 >
Date:18:04, 28 March 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fixed array issue
Modified paths:
  • /trunk/extensions/EducationProgram/specials/SpecialEducationProgram.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/specials/SpecialEducationProgram.php
@@ -197,10 +197,8 @@
198198 protected function getByTermTable( $terms ) {
199199 $html = Html::openElement( 'table', array( 'class' => 'wikitable ep-termbreakdown' ) );
200200
201 - $term = array_shift( $terms );
202 - $rows = array_keys( $term );
203 - array_unshift( $terms, $term );
204 -
 201+ reset( $terms );
 202+ $rows = array_keys( $terms[key( $terms )] );
205203 array_unshift( $rows, 'header' );
206204
207205 foreach ( $rows as $row ) {
@@ -288,19 +286,19 @@
289287 }
290288
291289 protected function getGenderDistribution( array $users, array $genders ) {
292 - $distibution = array( 'unknown' => 0, 'male' => 0, 'female' => 0 );
 290+ $distribution = array( 'unknown' => 0, 'male' => 0, 'female' => 0 );
293291
294292 foreach ( $users as $userId ) {
295 - $distibution[$genders[$userId]]++;
 293+ $distribution[$genders[$userId]]++;
296294 }
297295
298296 $userCount = count( $users );
299297
300 - foreach ( $distibution as &$amount ) {
 298+ foreach ( $distribution as &$amount ) {
301299 $amount = $userCount === 0 ? 1 : $amount / $userCount;
302300 }
303301
304 - return $distibution;
 302+ return $distribution;
305303 }
306304
307305 protected function getGenders( $userIds ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r114566Follow up to r114564; also apply fix herejeroendedauw18:19, 28 March 2012

Status & tagging log