r98322 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98321‎ | r98322 | r98323 >
Date:16:03, 28 September 2011
Author:reedy
Status:deferred
Tags:
Comment:
Update EstimateOfflineMetric

Date now comes from spreadsheet


Swap tabs to spaces in analytics_create_and_load_from_csv.txt
Modified paths:
  • /trunk/extensions/MetricsReporting/fetchGoogleSpreadsheet.php (modified) (history)
  • /trunk/extensions/MetricsReporting/metrics/EstimateOfflineMetric.php (modified) (history)
  • /trunk/wikistats/analytics/analytics_create_and_load_from_csv.txt (modified) (history)

Diff [purge]

Index: trunk/wikistats/analytics/analytics_create_and_load_from_csv.txt
@@ -102,7 +102,7 @@
103103
104104 CREATE TABLE `offline` (
105105 `date` date NOT NULL,
106 - `source` varchar (255),
 106+ `source` varchar (255),
107107 `readers` bigint (12),
108108 PRIMARY KEY (date,source)
109109 ) ;
Index: trunk/extensions/MetricsReporting/fetchGoogleSpreadsheet.php
@@ -92,7 +92,7 @@
9393
9494 $this->output( 'Spreadsheet tab title: ' . $xml->title . "\n" );
9595 $this->output( "\n" );
96 - var_dump( $xml->title );
 96+
9797 if ( $xml->title != 'Deployments' ) {
9898 continue;
9999 }
@@ -123,15 +123,9 @@
124124 * @param $data array
125125 */
126126 function getDeploymentFigures( $data ) {
127 - $count = count( $data["name"] );
128 -
129 - for( $i = 0; $i < ( $count - 1 ); $i++ ) {
130 - $data['date'][] = ''; // TODO: The date needs to come from... somewhere?
131 - }
132 -
133127 $db = $this->getDb();
134128
135 - $db->update( 'offline', $data, __METHOD__, array( 'IGNORE' ) );
 129+ $db->insert( 'offline', $data, __METHOD__, array( 'IGNORE' ) );
136130 }
137131
138132 /**
Index: trunk/extensions/MetricsReporting/metrics/EstimateOfflineMetric.php
@@ -10,14 +10,14 @@
1111 return array(
1212 'table' => 'offline',
1313 'conds' => array(),
14 - 'options' => array(),
 14+ 'options' => array( 'GROUP BY' => 'date' ),
1515 'join_conds' => array(),
1616 );
1717 }
1818
1919 protected function getQueryFields() {
2020 return array(
21 - 'date', 'readers',
 21+ 'date', 'SUM(readers)',
2222 );
2323 }
2424

Status & tagging log