Automattic\WooCommerce\Admin\API\Reports
DataStore::intervals_missing()
Returns true if there are any intervals that need to be filled in the response.
Method of the class: DataStore{}
No Hooks.
Return
true|false
.
Usage
// protected - for code of main (parent) or child class $result = $this->intervals_missing( $expected_interval_count, $db_records, $items_per_page, $page_no, $order, $order_by, $intervals_count );
- $expected_interval_count(int) (required)
- Expected number of intervals in total.
- $db_records(int) (required)
- Total number of records for given period in the database.
- $items_per_page(int) (required)
- Number of items per page.
- $page_no(int) (required)
- Page number.
- $order(string) (required)
- asc or desc.
- $order_by(string) (required)
- Column by which the result will be sorted.
- $intervals_count(int) (required)
- Number of records for given (possibly shortened) time interval.
DataStore::intervals_missing() DataStore::intervals missing code WC 9.3.3
protected function intervals_missing( $expected_interval_count, $db_records, $items_per_page, $page_no, $order, $order_by, $intervals_count ) { if ( $expected_interval_count <= $db_records ) { return false; } if ( 'date' === $order_by ) { $expected_intervals_on_page = $this->expected_intervals_on_page( $expected_interval_count, $items_per_page, $page_no ); return $intervals_count < $expected_intervals_on_page; } if ( 'desc' === $order ) { return $page_no > floor( $db_records / $items_per_page ); } if ( 'asc' === $order ) { return $page_no <= ceil( ( $expected_interval_count - $db_records ) / $items_per_page ); } // Invalid ordering. return false; }