-
-
Notifications
You must be signed in to change notification settings - Fork 107
Description
Module
fleet_vehicle_history_date_end
Describe the bug
The module incorrectly sets the date_end on a previous driver's history log to a date that is before that log's date_start. This occurs when a new driver is assigned with an "Assignment Date" set in the past, prior to the start date of the current driver. The logic does not validate that the new start date is chronologically after the previous one, leading to illogical and inconsistent data where a driver's assignment period has an end date that precedes its start date.
To Reproduce
Affected versions: 18.0
Steps to reproduce the behavior:
- Navigate to the Fleet application and select a vehicle.
- Assign a driver (e.g., "Driver A") to this vehicle. Note the "Assignment Date" (e.g., September 24, 2025). This creates a driver history log with this start date and no end date.
- Change the driver for the same vehicle to a new driver (e.g., "Driver B").
- In the driver assignment wizard, manually set the "Assignment Date" to a date in the past, before the previous assignment (e.g., September 1, 2025).
- Save the change.
- Go to the "Drivers History" tab for the vehicle and inspect the log for "Driver A". You will see that the "Start Date" is September 24, 2025, and the "End Date" has been set to September 1, 2025.
Expected behavior
The system should prevent the creation of an illogical history log. When a new driver is assigned with a date that precedes the start date of the current driver, one of two things should happen:
The system should raise a validation error, informing the user that the assignment date cannot be before the start date of the current driver's assignment.
Alternatively, the module's logic should be smart enough not to set an end date on the previous log entry in this specific scenario, leaving it open for manual correction.
The current behavior of setting an end date that is earlier than the start date should not be possible.
Additional context
This bug can lead to corrupt and unreliable data in the vehicle's driver history, which can negatively impact reporting, auditing, and any other process that relies on accurate driver assignment timelines.