Fix Call next when Care waiters lack Queue tickets.
Deploy Ladill Care / deploy (push) Successful in 1m35s
Deploy Ladill Care / deploy (push) Successful in 1m35s
Demo/pre-integration waiting lists showed patients but Call next hit an empty Queue and flashed a red error. Backfill missing tickets on Call next and queue load, and treat empty Call next as info. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -43,6 +43,13 @@ class QueueController extends Controller
|
||||
$branchId = (int) ($request->input('branch_id') ?: $branchScope ?: $branches->first()?->id);
|
||||
$practitionerId = $request->input('practitioner_id') ? (int) $request->input('practitioner_id') : null;
|
||||
|
||||
$queueIntegration = ['enabled' => false];
|
||||
if ($branchId && $this->queueBridge->isEnabled($organization)) {
|
||||
// Catch up tickets for waiters created before Queue was linked (demo / pre-enable).
|
||||
$this->queueBridge->syncMissingTickets($organization, CareQueueContexts::CONSULTATION, $branchId, 25);
|
||||
$queueIntegration = $this->queueBridge->listMeta($organization, CareQueueContexts::CONSULTATION, $branchId);
|
||||
}
|
||||
|
||||
$queue = $branchId
|
||||
? $this->appointments->queue($this->ownerRef($request), $branchId, $practitionerId)
|
||||
: collect();
|
||||
@@ -86,9 +93,7 @@ class QueueController extends Controller
|
||||
'canManageQueue' => $canManageQueue,
|
||||
'canConsult' => $canConsult,
|
||||
'heroStats' => $heroStats,
|
||||
'queueIntegration' => $branchId
|
||||
? $this->queueBridge->listMeta($organization, CareQueueContexts::CONSULTATION, $branchId)
|
||||
: ['enabled' => false],
|
||||
'queueIntegration' => $queueIntegration,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -106,7 +111,7 @@ class QueueController extends Controller
|
||||
$result = $this->queueBridge->callNext($organization, CareQueueContexts::CONSULTATION, $branchId);
|
||||
$ticket = $result['ticket'] ?? null;
|
||||
if (! $ticket) {
|
||||
return back()->with('error', 'No patients waiting in the consultation queue.');
|
||||
return back()->with('info', 'No patients waiting in the consultation queue.');
|
||||
}
|
||||
|
||||
return back()->with('success', 'Called '.$ticket['ticket_number'].' — '.($ticket['customer_name'] ?? 'patient').'.');
|
||||
|
||||
Reference in New Issue
Block a user