Fixing device health count mismatch issue

This commit is contained in:
2025-06-19 15:59:36 +05:30
parent 5698432fec
commit 65b0069ee4
2 changed files with 8 additions and 5 deletions

View File

@@ -952,8 +952,9 @@ class TelemetryController extends Controller
foreach ($deviceIds as $deviceId) {
$device = Device::find($deviceId);
if ($device) {
$deviceType = $device->type;
$telemetryValues = $this->getHealthConditionTelemetry($device);
$deviceHealth = $this->telemetryService->getDeviceHealth($telemetryValues);
$deviceHealth = $deviceType == 'Torque' ? 'green' : $this->telemetryService->getDeviceHealth($telemetryValues);
match ($deviceHealth) {
'green' => $good++,

View File

@@ -54,10 +54,10 @@ class TelemetryService
}
break;
case 'OT':
case 'AT':
$val > 50 ? $hasRed = true : $hasOrange = true;
break;
// case 'OT':
// case 'AT':
// $val > 50 ? $hasRed = true : $hasOrange = true;
// break;
case 'TDN':
if ($val > 0 && $val < 401) {
@@ -199,6 +199,7 @@ class TelemetryService
'red' => 'Alert',
'orange' => 'Attention',
'green' => 'Stable',
'blue' => 'Stable',
default => $t['threshold'] == 70 ? 'Stable' : 'Alert'
};
}
@@ -243,6 +244,7 @@ class TelemetryService
'health_status' => !$isActive
? 'Offline'
: (in_array($displayNameMap[$key], ['Speed', 'RPM']) ? 'Offline' : $status),
// 'health_status' => $status,
'status_color' => !$isActive ? 'gray' : $statusColor,
'thresholds' => $thresholds,
'limit' => $thresholdLimits