Skip to content

[18.0][BUG]fleet_vehicle_history_date_end: impossible end date, before start date #186

@rpsjr

Description

@rpsjr

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:

  1. Navigate to the Fleet application and select a vehicle.
  2. 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.
  3. Change the driver for the same vehicle to a new driver (e.g., "Driver B").
  4. 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).
  5. Save the change.
  6. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions