1
0
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:
Jon Ziebell 2024-08-17 07:25:09 -04:00
parent c015f634eb
commit 6e294377f2

View File

@ -507,23 +507,16 @@ class thermostat extends cora\crud {
$memory_per_thermostat = 0.0054; // mb
$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
* this up into several queries to avoid that.
*/
do {
$result = $this->database->query('
select
thermostat_id,
profile
from
thermostat
where ' .
implode(' and ', $where) . '
limit ' . $limit_start . ',' . $limit_count . '
');
$result = $this->database->query(
'select thermostat_id, profile from thermostat where ' . implode(' and ', $where) . ' limit ' . $limit_start . ',' . $limit_count . ''
);
// Get all the scores from the other thermostats
while($other_thermostat = $result->fetch_assoc()) {