Index: trunk/extensions/MetricsReporting/ApiAnalyticsBase.php |
— | — | @@ -7,6 +7,8 @@ |
8 | 8 | */ |
9 | 9 | protected $mDb; |
10 | 10 | |
| 11 | + protected $isCurrentlyNormalised = false; |
| 12 | + |
11 | 13 | public function __construct( ApiBase $query, $moduleName, $paramPrefix = '' ) { |
12 | 14 | parent::__construct( $query->getMain(), $moduleName, $paramPrefix ); |
13 | 15 | } |
— | — | @@ -36,7 +38,7 @@ |
37 | 39 | $params = $this->extractRequestParams(); |
38 | 40 | |
39 | 41 | if ( $this->canBeNormalised() && $params['normalized'] ) { |
40 | | - $this->normaliseQueryParameters( $params ); |
| 42 | + $this->normaliseQueryParameters( true ); |
41 | 43 | } |
42 | 44 | $query = $this->getQueryInfo(); |
43 | 45 | $query['fields'] = $this->getQueryFields(); |
— | — | @@ -49,8 +51,8 @@ |
50 | 52 | } else { |
51 | 53 | //add 1 month to end of date because of the way data is stored |
52 | 54 | $endMonth = date( "Y-m-d", strtotime( $params['endmonth'] . " +1 month" ) ); |
53 | | - |
54 | | - $query['conds'][] = "date >= ". $db->addQuotes( $params['startmonth'] ) |
| 55 | + |
| 56 | + $query['conds'][] = "date >= " . $db->addQuotes( $params['startmonth'] ) |
55 | 57 | . " AND date <= " . $db->addQuotes( $endMonth ) ; |
56 | 58 | } |
57 | 59 | |
— | — | @@ -235,8 +237,8 @@ |
236 | 238 | * @param $params array |
237 | 239 | * @return array |
238 | 240 | */ |
239 | | - public function normaliseQueryParameters( $params ) { |
240 | | - return $params; |
| 241 | + public function normaliseQueryParameters( $normalise = false ) { |
| 242 | + $this->isCurrentlyNormalised = $normalise; |
241 | 243 | } |
242 | 244 | |
243 | 245 | /** |
Index: trunk/extensions/MetricsReporting/metrics/SquidPageViewsMetric.php |
— | — | @@ -42,7 +42,8 @@ |
43 | 43 | // TODO: Change fields/table to normalise data set returned |
44 | 44 | // Swap page_views for page_views_v |
45 | 45 | |
46 | | - if (!$normalise ) { |
| 46 | + parent::normaliseQueryParameters( $normalise ); |
| 47 | + if ( !$normalise ) { |
47 | 48 | $this->queryFields = array( 'views_mobile_raw', 'views_non_mobile_raw' ); |
48 | 49 | } else { |
49 | 50 | $this->queryFields = array( 'views_mobile_normalized', 'views_non_mobile_normalized' ); |