diff --git a/server/src/Support/OrderTracker.php b/server/src/Support/OrderTracker.php index c3939897..eb6b061a 100644 --- a/server/src/Support/OrderTracker.php +++ b/server/src/Support/OrderTracker.php @@ -77,14 +77,10 @@ public function getOrderProgressPercentage(): int|float { $totalDistance = $this->getTotalDistance(); $completedDistance = $this->getCompletedDistance(); - - if ($totalDistance === -1 || $completedDistance === -1) { - return 0; - } + $cannotUseDistance = $totalDistance == -1 || $completedDistance == -1 || $completedDistance === 0; // Get order percentage by activity if distance-based progress is not available - $shouldCalculateProgressByActivity = empty($completedDistance) && $this->order->status !== 'created'; - if ($shouldCalculateProgressByActivity) { + if ($cannotUseDistance) { /** @var Collection $activities */ $activities = $this->order->orderConfig ? $this->order->orderConfig->activities() : collect(); $totalActivity = $activities->count();