Restore Care queue FIFO after demo skip left tickets Unassigned.
Deploy Ladill Care / deploy (push) Successful in 1m2s
Deploy Ladill Care / deploy (push) Successful in 1m2s
Provision one branch/context at a time instead of the whole org, fall back to a desk when doctor counters are catching up, sync pharmacy tickets in Care list order on page load, and seed waiting_at/queue_position for demos. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -407,26 +407,41 @@ class CareQueueBridge
|
||||
*/
|
||||
protected function resolveConsultationPoint(Organization $organization, Appointment $appointment): ?array
|
||||
{
|
||||
if ($appointment->practitioner_id) {
|
||||
$point = $this->provisioner->pointForPractitioner(
|
||||
$organization,
|
||||
(int) $appointment->branch_id,
|
||||
(int) $appointment->practitioner_id,
|
||||
);
|
||||
if ($point) {
|
||||
return $point;
|
||||
}
|
||||
// Practitioner assigned but point not provisioned yet — refresh once.
|
||||
$this->provisioner->ensure($organization, CareQueueContexts::CONSULTATION, (int) $appointment->branch_id);
|
||||
$branchId = (int) $appointment->branch_id;
|
||||
|
||||
return $this->provisioner->pointForPractitioner(
|
||||
$organization->fresh(),
|
||||
(int) $appointment->branch_id,
|
||||
(int) $appointment->practitioner_id,
|
||||
);
|
||||
// Assigned-only consultation requires a doctor — leave Unassigned until one is chosen.
|
||||
if (! $appointment->practitioner_id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
$point = $this->provisioner->pointForPractitioner(
|
||||
$organization,
|
||||
$branchId,
|
||||
(int) $appointment->practitioner_id,
|
||||
);
|
||||
if ($point) {
|
||||
return $point;
|
||||
}
|
||||
|
||||
// Practitioner assigned but point not provisioned yet — refresh this branch only.
|
||||
$this->provisioner->ensure($organization, CareQueueContexts::CONSULTATION, $branchId);
|
||||
|
||||
$point = $this->provisioner->pointForPractitioner(
|
||||
$organization->fresh(),
|
||||
$branchId,
|
||||
(int) $appointment->practitioner_id,
|
||||
);
|
||||
if ($point) {
|
||||
return $point;
|
||||
}
|
||||
|
||||
// Prefer a desk ticket over leaving waiters Unassigned while counters catch up
|
||||
// after demo seed / deferred settings provision.
|
||||
return $this->provisioner->defaultPoint(
|
||||
$organization->fresh(),
|
||||
CareQueueContexts::CONSULTATION,
|
||||
$branchId,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -659,6 +674,7 @@ class CareQueueBridge
|
||||
})
|
||||
->whereHas('visit', fn ($q) => $q->where('branch_id', $branchId))
|
||||
->with(['patient', 'visit'])
|
||||
->orderBy('created_at')
|
||||
->orderBy('id')
|
||||
->limit($limit)
|
||||
->get();
|
||||
|
||||
Reference in New Issue
Block a user