[M2] Single-Draft Vehicle Integrity & Auto-Resumption #4

Closed
opened 2026-09-04 14:59:49 +02:00 by JackPrince · 0 comments
Owner

Part of Epic #2

Description

Prevent duplicate open drafts per vehicle and automatically resume any active draft when a vehicle is selected in the UI.

Tasks

  • Backend: Enforce max 1 active draft (status: 'draft') per vehicle in TripIntegrityService / StoreTripRequest.
  • Frontend: Automatically load the active draft into TripFormCard when the driver selects a vehicle that has an open draft.
  • Display a prominent banner: "Resuming open draft from [Date]" with an explicit "Discard Draft" button (calling DELETE /api/trips/{id}).
  • Ensure nextOdometerForVehicle in tripFormModel.ts accounts for in-progress drafts cleanly.
  • Add PHPUnit integration tests in DraftTripTest.php.

Acceptance Criteria

  • A vehicle cannot have more than one open draft at any time.
  • Drivers returning to a car immediately resume their pending draft without creating duplicate trips.
Part of Epic #2 ## Description Prevent duplicate open drafts per vehicle and automatically resume any active draft when a vehicle is selected in the UI. ## Tasks - [x] **Backend:** Enforce max 1 active draft (`status: 'draft'`) per vehicle in `TripIntegrityService` / `StoreTripRequest`. - [x] **Frontend:** Automatically load the active draft into `TripFormCard` when the driver selects a vehicle that has an open draft. - [x] Display a prominent banner: *"Resuming open draft from [Date]"* with an explicit *"Discard Draft"* button (calling `DELETE /api/trips/{id}`). - [x] Ensure `nextOdometerForVehicle` in `tripFormModel.ts` accounts for in-progress drafts cleanly. - [x] Add PHPUnit integration tests in `DraftTripTest.php`. ## Acceptance Criteria - A vehicle cannot have more than one open draft at any time. - Drivers returning to a car immediately resume their pending draft without creating duplicate trips.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
JackPrince/GoBDLogBook#4
No description provided.