Skip to content

Commit

Permalink
fix(ZMS-3080): catching null waiting times when queue is empty (#600)
Browse files Browse the repository at this point in the history
* fix(ZMS-3080): catching null waiting times when queue is empty

* fix(ZMS-3080): rename waitingTimeOptim to waitingTimeOptimistic
  • Loading branch information
Fabinatix97 authored Oct 8, 2024
1 parent 8e6d86d commit 9cff0bd
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions zmscalldisplay/src/Zmscalldisplay/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

class Info extends BaseController
{

/**
* @SuppressWarnings(UnusedFormalParameter)
* @return ResponseInterface
Expand All @@ -28,32 +27,23 @@ public function readResponse(
->readPostResult('/calldisplay/queue/', $calldisplay->getEntity(false))
->getCollection();

$waitingClientsBefore = $queueListFull
->withoutStatus(Collection::STATUS_FAKE)
->getCountWithWaitingTime()
->count();

$waitingTimeFull = $queueListFull
$filteredQueue = $queueListFull
->withoutStatus(Collection::STATUS_FAKE)
->getCountWithWaitingTime()
->getLast()
->waitingTimeEstimate;
->getCountWithWaitingTime();

$waitingTimeOptim = $queueListFull
->withoutStatus(Collection::STATUS_FAKE)
->getCountWithWaitingTime()
->getLast()
->waitingTimeOptimistic;
$lastClient = $filteredQueue->getLast();
$waitingTimeFull = $lastClient ? $lastClient->waitingTimeEstimate : 0;
$waitingTimeOptimistic = $lastClient ? $lastClient->waitingTimeOptimistic : 0;

return Render::withHtml(
$response,
'element/tempWaitingValues.twig',
array(
'calldisplay' => $calldisplay,
'waitingClients' => $waitingClientsBefore,
'waitingClients' => $filteredQueue->count(),
'waitingTime' => $waitingTimeFull,
'waitingTimeOptimistic' => $waitingTimeOptim,
'waitingTimeOptimistic' => $waitingTimeOptimistic
)
);
}
}
}

0 comments on commit 9cff0bd

Please sign in to comment.