r102713 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102712‎ | r102713 | r102714 >
Date:23:26, 10 November 2011
Author:kaldari
Status:ok
Tags:
Comment:
quick fix for object/array issue
Modified paths:
  • /trunk/extensions/ContributionReporting/ContributionStatistics_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ContributionReporting/ContributionStatistics_body.php
@@ -58,8 +58,7 @@
5959 if( $this->mEndDate > time() && $this->mStartDate < time() ) {
6060 $this->showDailyTotals( $egContributionStatisticsViewDays );
6161 }
62 -
63 - // Show daily totals
 62+ // Show monthly totals
6463 $this->showMonthlyTotals( );
6564
6665 // Show currency totals
@@ -99,16 +98,20 @@
10099
101100 // Days
102101 foreach ( $days as $data ) {
 102+ $stats = array();
 103+ foreach( $data as $key => $value ) {
 104+ $stats[] = $value;
 105+ }
103106 $htmlOut .= Xml::tags( 'tr', null,
104 - Xml::element( 'td', array( 'align' => 'left' ), $data[0] ) .
105 - Xml::element( 'td', array( 'align' => 'left' ), $wgLang->formatNum( $data[1] ) ) .
106 - Xml::element( 'td', array( 'align' => 'right' ), $wgLang->formatNum( number_format( $data[2], 2 ) ) ) .
107 - Xml::element( 'td', array( 'align' => 'right' ), $wgLang->formatNum( number_format( $data[3], 2 ) ) ) .
108 - /*Xml::element( 'td', array( 'align' => 'right' ), $wgLang->formatNum( number_format( $data[5], 2 ) ) ) .*/
109 - Xml::element( 'td', array( 'align' => 'right' ), $wgLang->formatNum( number_format( $data[4], 2 ) ) ) .
 107+ Xml::element( 'td', array( 'align' => 'left' ), $stats[0] ) .
 108+ Xml::element( 'td', array( 'align' => 'left' ), $wgLang->formatNum( $stats[1] ) ) .
 109+ Xml::element( 'td', array( 'align' => 'right' ), $wgLang->formatNum( number_format( $stats[2], 2 ) ) ) .
 110+ Xml::element( 'td', array( 'align' => 'right' ), $wgLang->formatNum( number_format( $stats[3], 2 ) ) ) .
 111+ /*Xml::element( 'td', array( 'align' => 'right' ), $wgLang->formatNum( number_format( $stats[5], 2 ) ) ) .*/
 112+ Xml::element( 'td', array( 'align' => 'right' ), $wgLang->formatNum( number_format( $stats[4], 2 ) ) ) .
110113 Xml::element( 'td', array( 'align' => 'right' ), $wgLang->formatNum( number_format( $total, 2 ) ) )
111114 );
112 - $total -= $data[2];
 115+ $total -= $stats[2];
113116 }
114117
115118 $htmlOut .= Xml::closeElement( 'table' );
@@ -342,20 +345,24 @@
343346 // Build day/value array
344347 $totals = array();
345348 foreach ( $res as $row ) {
 349+ $stats = array();
 350+ foreach( $row as $key => $value ) {
 351+ $stats[] = $value;
 352+ }
346353 $median = $dbr->selectField( 'public_reporting',
347354 array( 'converted_amount' ),
348355 array(
349 - "FROM_UNIXTIME(received, '%Y-%m')" => $row[0]
 356+ "FROM_UNIXTIME(received, '%Y-%m')" => $stats[0]
350357 ),
351358 __METHOD__,
352359 array(
353360 'ORDER BY' => 'converted_amount DESC',
354 - 'OFFSET' => round( $row[1] / 2 ),
 361+ 'OFFSET' => round( $stats[1] / 2 ),
355362 'LIMIT' => 1
356363 )
357364 );
358 - $row[] = $median;
359 - $totals[] = $row;
 365+ $stats[] = $median;
 366+ $totals[] = $stats;
360367 }
361368
362369 // Return results
@@ -385,23 +392,27 @@
386393
387394 $totals = array();
388395 foreach ( $res as $row ) {
 396+ $stats = array();
 397+ foreach( $row as $key => $value ) {
 398+ $stats[] = $value;
 399+ }
389400 $median = $dbr->selectField( 'public_reporting',
390401 array( 'converted_amount' ),
391402 array_merge(
392403 $this->dateConds( $dbr ),
393404 array(
394 - 'original_currency' => $row[0]
 405+ 'original_currency' => $stats[0]
395406 )
396407 ),
397408 __METHOD__,
398409 array(
399410 'ORDER BY' => 'converted_amount DESC',
400 - 'OFFSET' => round( $row[1] / 2 ),
 411+ 'OFFSET' => round( $stats[1] / 2 ),
401412 'LIMIT' => 1,
402413 )
403414 );
404 - $row[] = $median;
405 - $totals[$row[0]] = $row;
 415+ $stats[] = $median;
 416+ $totals[$stats[0]] = $stats;
406417 }
407418
408419 if ( isset( $totals[null] ) ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r102715MFT r102713awjrichards23:29, 10 November 2011

Status & tagging log