Index: trunk/wikistats/analytics/analytics_create_and_load_from_csv.txt |
— | — | @@ -102,7 +102,7 @@ |
103 | 103 | |
104 | 104 | CREATE TABLE `offline` ( |
105 | 105 | `date` date NOT NULL, |
106 | | - `source` varchar (255), |
| 106 | + `source` varchar (255), |
107 | 107 | `readers` bigint (12), |
108 | 108 | PRIMARY KEY (date,source) |
109 | 109 | ) ; |
Index: trunk/extensions/MetricsReporting/fetchGoogleSpreadsheet.php |
— | — | @@ -92,7 +92,7 @@ |
93 | 93 | |
94 | 94 | $this->output( 'Spreadsheet tab title: ' . $xml->title . "\n" ); |
95 | 95 | $this->output( "\n" ); |
96 | | - var_dump( $xml->title ); |
| 96 | + |
97 | 97 | if ( $xml->title != 'Deployments' ) { |
98 | 98 | continue; |
99 | 99 | } |
— | — | @@ -123,15 +123,9 @@ |
124 | 124 | * @param $data array |
125 | 125 | */ |
126 | 126 | 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 | | - |
133 | 127 | $db = $this->getDb(); |
134 | 128 | |
135 | | - $db->update( 'offline', $data, __METHOD__, array( 'IGNORE' ) ); |
| 129 | + $db->insert( 'offline', $data, __METHOD__, array( 'IGNORE' ) ); |
136 | 130 | } |
137 | 131 | |
138 | 132 | /** |
Index: trunk/extensions/MetricsReporting/metrics/EstimateOfflineMetric.php |
— | — | @@ -10,14 +10,14 @@ |
11 | 11 | return array( |
12 | 12 | 'table' => 'offline', |
13 | 13 | 'conds' => array(), |
14 | | - 'options' => array(), |
| 14 | + 'options' => array( 'GROUP BY' => 'date' ), |
15 | 15 | 'join_conds' => array(), |
16 | 16 | ); |
17 | 17 | } |
18 | 18 | |
19 | 19 | protected function getQueryFields() { |
20 | 20 | return array( |
21 | | - 'date', 'readers', |
| 21 | + 'date', 'SUM(readers)', |
22 | 22 | ); |
23 | 23 | } |
24 | 24 | |