Fallback Fix
This commit is contained in:
parent
0b8ad755a0
commit
bcd5f52a65
|
@ -13,7 +13,7 @@ class FallbackManager
|
||||||
|
|
||||||
function check(){
|
function check(){
|
||||||
//TODO: FIX IT
|
//TODO: FIX IT
|
||||||
/*$allDevicesData = DeviceManager::getAllDevices();
|
$allDevicesData = DeviceManager::getAllDevices();
|
||||||
foreach ($allDevicesData as $deviceKey => $deviceValue) {
|
foreach ($allDevicesData as $deviceKey => $deviceValue) {
|
||||||
$allSubDevicesData = SubDeviceManager::getAllSubDevices($deviceValue['device_id']);
|
$allSubDevicesData = SubDeviceManager::getAllSubDevices($deviceValue['device_id']);
|
||||||
foreach ($allSubDevicesData as $subDeviceKey => $subDeviceValue) {
|
foreach ($allSubDevicesData as $subDeviceKey => $subDeviceValue) {
|
||||||
|
@ -22,12 +22,15 @@ class FallbackManager
|
||||||
}
|
}
|
||||||
|
|
||||||
$lastRecord = RecordManager::getLastRecord($subDeviceValue['subdevice_id']);
|
$lastRecord = RecordManager::getLastRecord($subDeviceValue['subdevice_id']);
|
||||||
$minutes = (time() - $lastRecord['time']) / 60;
|
if ($lastRecord["value"] == $this->deviceDefinitions[$subDeviceValue['type']]["fallBack"]) {
|
||||||
echo $minutes;
|
return;
|
||||||
if ( $minutes > 2){
|
}
|
||||||
|
|
||||||
|
$minutes = (strtotime($lastRecord['time']) - time()) / 60;
|
||||||
|
if ( $minutes > 3){
|
||||||
RecordManager::create($deviceValue['device_id'], $subDeviceValue['type'], $this->deviceDefinitions[$subDeviceValue['type']]["fallBack"]);
|
RecordManager::create($deviceValue['device_id'], $subDeviceValue['type'], $this->deviceDefinitions[$subDeviceValue['type']]["fallBack"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue