diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-03-04 02:00:31 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2015-03-09 06:13:18 +0300 |
commit | 3c3a11b6948a9b4a32f0fa2bc9e40c6ecf2177b9 (patch) | |
tree | d26f85111435f25ffb758912c844218f8feb99e4 /core/ViewDataTable | |
parent | c1eb5d6d0887b21a132ba09c826f4c94b9e05424 (diff) |
Run queued filters after generic filters making visualizations much faster.
Diffstat (limited to 'core/ViewDataTable')
-rw-r--r-- | core/ViewDataTable/Config.php | 16 | ||||
-rw-r--r-- | core/ViewDataTable/Request.php | 14 | ||||
-rw-r--r-- | core/ViewDataTable/RequestConfig.php | 34 |
3 files changed, 24 insertions, 40 deletions
diff --git a/core/ViewDataTable/Config.php b/core/ViewDataTable/Config.php index 220a253518..f4eef3c639 100644 --- a/core/ViewDataTable/Config.php +++ b/core/ViewDataTable/Config.php @@ -557,7 +557,7 @@ class Config /** * @ignore */ - public function getFiltersToRun() + private function getFiltersToRun() { $priorityFilters = array(); $presentationFilters = array(); @@ -581,6 +581,20 @@ class Config return array($priorityFilters, $presentationFilters); } + public function getPriorityFilters() + { + $filters = $this->getFiltersToRun(); + + return $filters[0]; + } + + public function getPresentationFilters() + { + $filters = $this->getFiltersToRun(); + + return $filters[1]; + } + /** * Adds a related report to the {@link $related_reports} property. If the report * references the one that is currently being displayed, it will not be added to the related diff --git a/core/ViewDataTable/Request.php b/core/ViewDataTable/Request.php index 352ce25899..259d4caaa1 100644 --- a/core/ViewDataTable/Request.php +++ b/core/ViewDataTable/Request.php @@ -32,15 +32,11 @@ class Request * It builds the API request string and uses Request to call the API. * The requested DataTable object is stored in $this->dataTable. */ - public function loadDataTableFromAPI($fixedRequestParams = array()) + public function loadDataTableFromAPI() { // we build the request (URL) to call the API $requestArray = $this->getRequestArray(); - foreach ($fixedRequestParams as $key => $value) { - $requestArray[$key] = $value; - } - // we make the request to the API $request = new ApiRequest($requestArray); @@ -104,6 +100,14 @@ class Request unset($requestArray['filter_limit']); } + if ($this->requestConfig->disable_generic_filters) { + $requestArray['disable_generic_filters'] = '0'; + } + + if ($this->requestConfig->disable_queued_filters) { + $requestArray['disable_queued_filters'] = 0; + } + return $requestArray; } diff --git a/core/ViewDataTable/RequestConfig.php b/core/ViewDataTable/RequestConfig.php index 753ee55b98..a6c9b7bed8 100644 --- a/core/ViewDataTable/RequestConfig.php +++ b/core/ViewDataTable/RequestConfig.php @@ -314,35 +314,6 @@ class RequestConfig $this->filter_sort_order = 'desc'; } - /** - * Returns `true` if queued filters have been disabled, `false` if otherwise. - * - * @return bool - */ - public function areQueuedFiltersDisabled() - { - return isset($this->disable_queued_filters) && $this->disable_queued_filters; - } - - /** - * Returns `true` if generic filters have been disabled, `false` if otherwise. - * - * @return bool - */ - public function areGenericFiltersDisabled() - { - // if disable_generic_filters query param is set to '1', generic filters are disabled - if (Common::getRequestVar('disable_generic_filters', '0', 'string') == 1) { - return true; - } - - if (isset($this->disable_generic_filters) && true === $this->disable_generic_filters) { - return true; - } - - return false; - } - public function getApiModuleToRequest() { list($module, $method) = explode('.', $this->apiMethodToRequestDataTable); @@ -356,9 +327,4 @@ class RequestConfig return $method; } - - public function shouldFormatMetrics() - { - return Common::getRequestVar('format_metrics', '1', 'string', $this->request_parameters_to_modify) != 0; - } } |