1
0
mirror of https://github.com/beestat/app.git synced 2025-07-09 03:04:07 -04:00

Fixed #394 - Error in query (1062): Duplicate entry ...

This commit is contained in:
Jon Ziebell 2023-05-12 07:45:39 -04:00
parent efbf04d3d4
commit 18429dd8ac

View File

@ -544,9 +544,6 @@ class runtime extends cora\api {
$data = [];
$data['thermostat_id'] = $thermostat['thermostat_id'];
$data['timestamp'] = $timestamp;
if ($columns['compCool1'] > 0 || $columns['compCool2'] > 0) {
$data['compressor_mode'] = 'cool';
$data['compressor_1'] = $columns['compCool1'] - $columns['compCool2'];
@ -656,6 +653,9 @@ class runtime extends cora\api {
$this->database->update('runtime_thermostat', $data, 'id');
}
else {
$data['thermostat_id'] = $thermostat['thermostat_id'];
$data['timestamp'] = $timestamp;
$existing_timestamps[$timestamp] = $this->database->create('runtime_thermostat', $data, 'id');
}
}