Updated recent output_flag on every testing panel readings creation via post api #1481
@@ -265,6 +265,10 @@ class TestingPanelController extends Controller
|
||||
// // ->select(TestingPanelReading::raw('MAX(CAST(update_count AS INTEGER)) AS max_update_count'))->value('max_update_count');
|
||||
// // ->value('update_count')
|
||||
|
||||
$currOutputFlag = TestingPanelReading::where('plant_id', $plantId)->where('serial_number', $serial['serial_number'] ?? null)->orderByDesc('updated_at')->first();
|
||||
|
||||
$outputFlag = $currOutputFlag->output_flag ?? '0';
|
||||
|
||||
// First, get the maximum length
|
||||
$maxLength = TestingPanelReading::where($updateCount)->selectRaw('MAX(LENGTH(update_count)) as max_length')->value('max_length');
|
||||
|
||||
@@ -324,7 +328,7 @@ class TestingPanelController extends Controller
|
||||
'test_sequence_flag' => $serial['test_sequence_flag'] ?? '4',
|
||||
'test_started_at' => $serial['test_started_at'] ?? null,
|
||||
'test_finished_at' => $serial['test_finished_at'] ?? null,
|
||||
'output_flag' => $serial['output_flag'] ?? 0,
|
||||
'output_flag' => $outputFlag, // $serial['output_flag'] ?? 0,
|
||||
'tested_by' => (($serial['tested_by'] == 'jothi') ? 'Admin' : $serial['tested_by']) ?? null,
|
||||
'updated_by' => (($serial['updated_by'] == 'jothi') ? 'Admin' : $serial['updated_by']) ?? null,
|
||||
'created_at' => $serial['created_at'] ?? null,
|
||||
|
||||
Reference in New Issue
Block a user