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:
@@ -9,6 +9,8 @@ use App\Services\Care\AppointmentPatientNotifier;
|
||||
use App\Services\Care\AuditLogger;
|
||||
use App\Services\Care\CareFeatures;
|
||||
use App\Services\Care\CarePermissions;
|
||||
use App\Services\Care\CareQueueBridge;
|
||||
use App\Services\Care\CareQueueContexts;
|
||||
use App\Services\Care\CareQueueProvisioner;
|
||||
use App\Services\Care\PlanService;
|
||||
use App\Services\Billing\PlatformEmailClient;
|
||||
@@ -155,7 +157,22 @@ class SettingsController extends Controller
|
||||
|
||||
if ($wantsQueue && $queue->configured()) {
|
||||
try {
|
||||
$provisioner->provisionOrganization($organization->fresh());
|
||||
$organization = $organization->fresh();
|
||||
$provisioner->provisionOrganization($organization);
|
||||
// Backfill tickets for patients already waiting when Queue was just linked.
|
||||
$bridge = app(CareQueueBridge::class);
|
||||
$branches = Branch::owned($owner)
|
||||
->where('organization_id', $organization->id)
|
||||
->where('is_active', true)
|
||||
->pluck('id');
|
||||
foreach ($branches as $branchId) {
|
||||
foreach (array_keys(CareQueueContexts::departments()) as $context) {
|
||||
if ($context === CareQueueContexts::RECEPTION) {
|
||||
continue;
|
||||
}
|
||||
$bridge->syncMissingTickets($organization, $context, (int) $branchId, 50);
|
||||
}
|
||||
}
|
||||
} catch (\Throwable) {
|
||||
// Best-effort; role pages will lazy-ensure on next use.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user