Skip to content

Allow a ride to be set as "Cancelled" during driver feedback #98

@AlexGilleran

Description

@AlexGilleran

Currently, if once a ride has been offered by a driver, and that ride's time is in the past, the driver will be prompted to give feedback on the ride (e.g. was it on time, did you have to use the parking permit etc). However, sometimes rides can be cancelled at the last minute - e.g. the client gets sick and can't go anymore. However, once the time of the ride has passed, our system assumes that the ride has happened, and the driver is prompted to enter feedback for the ride - they're able to say that the ride did not happen at all, but we still end up setting it as "complete", which isn't really true, it should be set as "cancelled". Because it gets set wrong, reporting and so forth ends up being incorrect for these rides.

image

In this case we need to mark the ride as "CANCELLED" instead of "ENDED".

How to do it

When the form gets submitted, it's submitted to the /api/rides/{rideId}/complete endpoint, which you'll find the code for here.

We'll need to change the way that the status gets set so that if the new "Ride did not go ahead" value is chosen, the status will be set to CANCELLED rather than ENDED.

The line of code that does this currently is here. It needs to be changed to be something like:

await rideRepository.setStatus(
  id,
  body.lateness = 'didNotHappen' ? 'CANCELLED' : 'ENDED',
  jwt.userId,
  jwt.name,
  connection
);

To test

  1. Log in as an account that has both driver and facilitator roles
  2. Make a new ride, as close to the current time as possible, with a client whose preferences allow your account to pick up the ride (i.e. if your account is marked as having an SUV, don't make a ride for a client who prefers no SUV)
  3. Once you've made the ride, immediately go to "Find a ride" and accept the one that you just created
  4. Wait until the ride time is in the past
  5. Open the ride and click "Complete the ride"
  6. Fill out the form and select "Did NOT happen at all" under "Tell us about the pickup" (fill out the rest of the form with whatever you like) and submit
  7. Go back to the "edit rides" page and check that the ride is marked as "CANCELLED" rather than "ENDED"

Regression test

Do all the steps above, but select something other than "Did NOT happen at all" (e.g. "On time"), and make sure that the ride is marked as "ENDED" and not "CANCELLED"

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions