Align specialty queue board with hero waiting counts.
Deploy Ladill Care / deploy (push) Successful in 35s

Board lists used type-only departments while KPIs used provisioned department IDs, so Waiting could show N with an empty WAITING column.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-20 18:52:03 +00:00
co-authored by Cursor
parent 9443465c5c
commit 4dd683161a
3 changed files with 87 additions and 5 deletions
@@ -237,4 +237,66 @@ class CareWomensHealthSuiteTest extends TestCase
->assertOk()
->assertDontSee('Health overview');
}
public function test_queue_board_lists_waiting_on_provisioned_non_type_departments(): void
{
// KPIs use specialty_module_provisioning.department_ids; the board used to
// only load departments by type=womens_health, so hero said "Waiting: N"
// while WAITING stayed empty.
$legacyDesk = Department::create([
'owner_ref' => $this->owner->public_id,
'organization_id' => $this->organization->id,
'branch_id' => $this->branch->id,
'name' => 'ANC desk',
'type' => 'maternity',
'is_active' => true,
]);
$settings = $this->organization->settings ?? [];
$provisioning = $settings['specialty_module_provisioning']['womens_health'] ?? [];
$provisioning['department_ids'] = [$legacyDesk->id];
$settings['specialty_module_provisioning']['womens_health'] = $provisioning;
$this->organization->update(['settings' => $settings]);
$this->organization->refresh();
$patient = Patient::create([
'owner_ref' => $this->owner->public_id,
'organization_id' => $this->organization->id,
'branch_id' => $this->branch->id,
'patient_number' => 'P-WH-QUEUE',
'first_name' => 'Efua',
'last_name' => 'Asante',
'gender' => 'female',
'date_of_birth' => '1990-03-12',
]);
$visit = Visit::create([
'owner_ref' => $this->owner->public_id,
'organization_id' => $this->organization->id,
'branch_id' => $this->branch->id,
'patient_id' => $patient->id,
'status' => Visit::STATUS_OPEN,
'checked_in_at' => now(),
]);
Appointment::create([
'owner_ref' => $this->owner->public_id,
'organization_id' => $this->organization->id,
'branch_id' => $this->branch->id,
'patient_id' => $patient->id,
'department_id' => $legacyDesk->id,
'visit_id' => $visit->id,
'type' => Appointment::TYPE_WALK_IN,
'status' => Appointment::STATUS_WAITING,
'scheduled_at' => now(),
'waiting_at' => now(),
'checked_in_at' => now(),
]);
$this->actingAs($this->owner)
->get(route('care.specialty.show', 'womens_health'))
->assertOk()
->assertSee('Efua Asante')
->assertDontSee('No patients waiting.');
}
}