Update: 2026-07-30 02:27:45
This commit is contained in:
@@ -40,15 +40,21 @@ if (!$batch || ($decoded['role'] !== 'super_admin' && $batch['tenant_id'] !== $t
|
||||
|
||||
// 2. Get items
|
||||
$stmt = $db->prepare("
|
||||
SELECT id, invoice_id, image_order, status, error_message, created_at, processed_at
|
||||
SELECT id, invoice_id, image_order, status, attempts, max_attempts, error_message, created_at, processed_at
|
||||
FROM invoice_processing_queue
|
||||
WHERE batch_id = ?
|
||||
ORDER BY image_order ASC
|
||||
ORDER BY image_order ASC, id ASC
|
||||
");
|
||||
$stmt->execute([$batchId]);
|
||||
$items = $stmt->fetchAll();
|
||||
|
||||
// 3. Tell the client explicitly whether it should keep polling. Without this the
|
||||
// app polled forever whenever a batch ended in anything other than 'done'.
|
||||
$isTerminal = in_array($batch['status'], ['done', 'partial_fail', 'failed'], true);
|
||||
|
||||
json_success([
|
||||
'batch' => $batch,
|
||||
'items' => $items
|
||||
'batch' => $batch,
|
||||
'items' => $items,
|
||||
'is_terminal' => $isTerminal,
|
||||
'should_poll' => !$isTerminal,
|
||||
], 'تم جلب حالة الدفعة');
|
||||
|
||||
Reference in New Issue
Block a user