From 4970a3d093b304015cff1fd9e72561bcd3e970dd Mon Sep 17 00:00:00 2001 From: "raja.lmsace@gmail.com" Date: Thu, 18 Jul 2024 16:31:57 +0530 Subject: [PATCH] Activity completion data source table loaded issue fixed. --- .../dash_framework/query_builder/builder.php | 15 --------------- .../local/data_source/abstract_data_source.php | 18 +++--------------- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/classes/local/dash_framework/query_builder/builder.php b/classes/local/dash_framework/query_builder/builder.php index 7321b34..73e86c3 100644 --- a/classes/local/dash_framework/query_builder/builder.php +++ b/classes/local/dash_framework/query_builder/builder.php @@ -449,21 +449,6 @@ public function query() { return $DB->get_records_sql($sql, $params, $this->get_limitfrom(), $this->get_limitnum()); } - - /** - * Return the all records from this query - * - * @return array - * @throws dml_exception - * @throws exception\invalid_operator_exception - */ - public function get_all_records_query() { - global $DB; - - [$sql, $params] = $this->get_sql_and_params(); - return $DB->get_records_sql($sql, $params); - } - /** * Get number of records this query will return. * diff --git a/classes/local/data_source/abstract_data_source.php b/classes/local/data_source/abstract_data_source.php index 6190843..b3ffdab 100644 --- a/classes/local/data_source/abstract_data_source.php +++ b/classes/local/data_source/abstract_data_source.php @@ -100,11 +100,6 @@ abstract class abstract_data_source implements data_source_interface, \templatab */ private $tables = []; - /** - * @var int - */ - protected $count; - /** * Constructor. * @@ -187,11 +182,11 @@ public function get_paginator(): paginator { if ($this->paginator == null) { $this->paginator = new paginator(function () { - $this->count = $this->get_data_records_count(); + $count = $this->get_query()->count(); if ($maxlimit = $this->get_max_limit()) { - return $maxlimit < $this->count ? $maxlimit : $this->count; + return $maxlimit < $count ? $maxlimit : $count; } - return $this->count; + return $count; }, 0, $perpage); } @@ -724,11 +719,4 @@ public function is_widget() { return false; } - /** - * Get a data source table records count - */ - public function get_data_records_count() { - return $this->get_query()->count(); - } - }