Overview
After upgrading FleetOps to v0.6.50, simple orders (Pickup/Dropoff only) become stuck in a status loop. The GET /v1/orders/{id}/next-activity endpoint incorrectly returns the current activity code (e.g., enroute for Transport order config) as the next activity, preventing drivers from progressing to the next stage (e.g., completed).
Environment
- FleetOps Version: v0.6.50
- Mobile App: Fleetbase Navigator
- Order Type: Transport (Pickup & Dropoff, waypoints_count = 0)
Reproduction Steps
- Create a standard Transport order with a Pickup and Dropoff.
- Dispatch the order to a driver.
- As a driver, start the order (moving orders.status to
enroute).
- The mobile app calls GET /v1/orders/{id}/next-activity?waypoint={pickup_place_public_id}.
- Observe the API response.
Expected Result
The API should return the next logical activity: completed.
Actual Result
The API returns the current activity: enroute. The driver is prompted to perform the same action repeatedly.
Root Cause Analysis
The investigation reveals a conflict between the new Waypoint Flow logic and the legacy Order Flow update mechanism.
- Context Switching: In v0.6.50, OrderController::getNextActivity prioritizes the waypoint parameter. If a record exists in the waypoints table for the provided Place ID, the system switches to a Waypoint context.
- Data Desynchronization: For simple orders, update-activity only updates the orders.status column. The corresponding records in the waypoints table
if ($waypointContext && in_array($childActivity->code, ['created', 'started', 'dispatched'])) {
return $childActivity->getChildActivities($context);
}
- The Loop: Because the Waypoint status is "frozen" at created, the logic starts calculating from the beginning of the flow, skips the system statuses, and stops at the first non-system status: driver_enroute_to_pickup. It ignores the fact that the Order is already at this status.
Suggested Resolution
- Ensure that updateActivity synchronizes the status of relevant waypoints even for simple orders.
- OR: Modify getNextActivity to ignore the waypoint context if the order is not a isMultipleDropOrder.
- OR: Update the recursive skip logic in Activity.php to account for the current Order status even when a Waypoint context is provided.
Overview
After upgrading FleetOps to v0.6.50, simple orders (Pickup/Dropoff only) become stuck in a status loop. The GET
/v1/orders/{id}/next-activityendpoint incorrectly returns the current activity code (e.g., enroute for Transport order config) as the next activity, preventing drivers from progressing to the next stage (e.g., completed).Environment
Reproduction Steps
enroute).Expected Result
The API should return the next logical activity:
completed.Actual Result
The API returns the current activity:
enroute. The driver is prompted to perform the same action repeatedly.Root Cause Analysis
The investigation reveals a conflict between the new Waypoint Flow logic and the legacy Order Flow update mechanism.
Suggested Resolution