Filter now-serving to the latest called/serving ticket per destination so historical calls no longer crowd the public board, and scale ticket cards so numbers no longer clip destination text. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -99,11 +99,11 @@ class DisplayVoiceTest extends TestCase
|
||||
->assertSee('Counter 1');
|
||||
}
|
||||
|
||||
public function test_display_returns_enough_active_tickets_for_a_busy_grid(): void
|
||||
public function test_display_shows_only_latest_ticket_per_counter(): void
|
||||
{
|
||||
[$user, , $branch, $queue] = $this->setUpOrg();
|
||||
|
||||
$counter = Counter::create([
|
||||
$room12 = Counter::create([
|
||||
'owner_ref' => $user->public_id,
|
||||
'organization_id' => $queue->organization_id,
|
||||
'branch_id' => $queue->branch_id,
|
||||
@@ -111,6 +111,14 @@ class DisplayVoiceTest extends TestCase
|
||||
'status' => 'available',
|
||||
'is_active' => true,
|
||||
]);
|
||||
$room14 = Counter::create([
|
||||
'owner_ref' => $user->public_id,
|
||||
'organization_id' => $queue->organization_id,
|
||||
'branch_id' => $queue->branch_id,
|
||||
'name' => 'Room 14',
|
||||
'status' => 'available',
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
$screen = DisplayScreen::create([
|
||||
'owner_ref' => $user->public_id,
|
||||
@@ -122,27 +130,33 @@ class DisplayVoiceTest extends TestCase
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
foreach (range(1, 7) as $number) {
|
||||
foreach ([
|
||||
['A001', $room12->id, 6],
|
||||
['A002', $room12->id, 5],
|
||||
['A003', $room12->id, 2],
|
||||
['A004', $room14->id, 4],
|
||||
['A005', $room14->id, 1],
|
||||
] as [$number, $counterId, $minutesAgo]) {
|
||||
Ticket::create([
|
||||
'owner_ref' => $user->public_id,
|
||||
'organization_id' => $queue->organization_id,
|
||||
'branch_id' => $branch->id,
|
||||
'service_queue_id' => $queue->id,
|
||||
'counter_id' => $counter->id,
|
||||
'ticket_number' => sprintf('A%03d', $number),
|
||||
'counter_id' => $counterId,
|
||||
'ticket_number' => $number,
|
||||
'status' => 'called',
|
||||
'issued_at' => now()->subMinutes(20 - $number),
|
||||
'called_at' => now()->subMinutes(7 - $number),
|
||||
'issued_at' => now()->subMinutes(20),
|
||||
'called_at' => now()->subMinutes($minutesAgo),
|
||||
]);
|
||||
}
|
||||
|
||||
$this->getJson(route('qms.display.data', $screen->access_token))
|
||||
->assertOk()
|
||||
->assertJsonCount(7, 'now_serving')
|
||||
->assertJsonPath('now_serving.0.ticket_number', 'A007')
|
||||
->assertJsonPath('now_serving.0.queue_name', 'Reception')
|
||||
->assertJsonPath('now_serving.0.counter', 'Room 12')
|
||||
->assertJsonPath('now_serving.6.ticket_number', 'A001');
|
||||
->assertJsonCount(2, 'now_serving')
|
||||
->assertJsonPath('now_serving.0.ticket_number', 'A005')
|
||||
->assertJsonPath('now_serving.0.counter', 'Room 14')
|
||||
->assertJsonPath('now_serving.1.ticket_number', 'A003')
|
||||
->assertJsonPath('now_serving.1.counter', 'Room 12');
|
||||
}
|
||||
|
||||
public function test_display_falls_back_to_branch_queues_when_none_assigned(): void
|
||||
|
||||
Reference in New Issue
Block a user