mirror of
https://github.com/beestat/app.git
synced 2025-05-24 02:14:03 -04:00
Fixed #413 - Comparison counts sometimes decrease when switching from global/all to something more specific
This commit is contained in:
parent
c015f634eb
commit
6e294377f2
@ -507,23 +507,16 @@ class thermostat extends cora\crud {
|
|||||||
$memory_per_thermostat = 0.0054; // mb
|
$memory_per_thermostat = 0.0054; // mb
|
||||||
|
|
||||||
$limit_start = 0;
|
$limit_start = 0;
|
||||||
$limit_count = round($memory_limit / $memory_per_thermostat);
|
$limit_count = (int) round($memory_limit / $memory_per_thermostat);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selecting lots of rows can eventually run PHP out of memory, so chunk
|
* Selecting lots of rows can eventually run PHP out of memory, so chunk
|
||||||
* this up into several queries to avoid that.
|
* this up into several queries to avoid that.
|
||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
$result = $this->database->query('
|
$result = $this->database->query(
|
||||||
select
|
'select thermostat_id, profile from thermostat where ' . implode(' and ', $where) . ' limit ' . $limit_start . ',' . $limit_count . ''
|
||||||
thermostat_id,
|
);
|
||||||
profile
|
|
||||||
from
|
|
||||||
thermostat
|
|
||||||
where ' .
|
|
||||||
implode(' and ', $where) . '
|
|
||||||
limit ' . $limit_start . ',' . $limit_count . '
|
|
||||||
');
|
|
||||||
|
|
||||||
// Get all the scores from the other thermostats
|
// Get all the scores from the other thermostats
|
||||||
while($other_thermostat = $result->fetch_assoc()) {
|
while($other_thermostat = $result->fetch_assoc()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user