r102715 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102714‎ | r102715 | r102716 >
Date:23:29, 10 November 2011
Author:awjrichards
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionStatistics_body.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/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' );
@@ -343,20 +346,24 @@
344347 // Build day/value array
345348 $totals = array();
346349 foreach ( $res as $row ) {
 350+ $stats = array();
 351+ foreach( $row as $key => $value ) {
 352+ $stats[] = $value;
 353+ }
347354 $median = $dbr->selectField( 'public_reporting',
348355 array( 'converted_amount' ),
349356 array(
350 - "FROM_UNIXTIME(received, '%Y-%m')" => $row[0]
 357+ "FROM_UNIXTIME(received, '%Y-%m')" => $stats[0]
351358 ),
352359 __METHOD__,
353360 array(
354361 'ORDER BY' => 'converted_amount DESC',
355 - 'OFFSET' => round( $row[1] / 2 ),
 362+ 'OFFSET' => round( $stats[1] / 2 ),
356363 'LIMIT' => 1
357364 )
358365 );
359 - $row[] = $median;
360 - $totals[] = $row;
 366+ $stats[] = $median;
 367+ $totals[] = $stats;
361368 }
362369
363370 // Return results
@@ -386,23 +393,27 @@
387394
388395 $totals = array();
389396 foreach ( $res as $row ) {
 397+ $stats = array();
 398+ foreach( $row as $key => $value ) {
 399+ $stats[] = $value;
 400+ }
390401 $median = $dbr->selectField( 'public_reporting',
391402 array( 'converted_amount' ),
392403 array_merge(
393404 $this->dateConds( $dbr ),
394405 array(
395 - 'original_currency' => $row[0]
 406+ 'original_currency' => $stats[0]
396407 )
397408 ),
398409 __METHOD__,
399410 array(
400411 'ORDER BY' => 'converted_amount DESC',
401 - 'OFFSET' => round( $row[1] / 2 ),
 412+ 'OFFSET' => round( $stats[1] / 2 ),
402413 'LIMIT' => 1,
403414 )
404415 );
405 - $row[] = $median;
406 - $totals[$row[0]] = $row;
 416+ $stats[] = $median;
 417+ $totals[$stats[0]] = $stats;
407418 }
408419
409420 if ( isset( $totals[null] ) ) {
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionStatistics_body.php
___________________________________________________________________
Modified: svn:mergeinfo
410421 Merged /trunk/extensions/ContributionReporting/ContributionStatistics_body.php:r102713
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting
___________________________________________________________________
Modified: svn:mergeinfo
411422 Merged /trunk/extensions/ContributionReporting:r102713

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102713quick fix for object/array issuekaldari23:26, 10 November 2011

Status & tagging log