Pining one driver at a time

Hello guys
am working on a delivery app and is in need of some idear on how to allocate my drivers tasks one at a time and if the driver cancels the request can it pin the next rider… using data from airtable kindly advice

I am assuming you have the coordinates of the drivers.

The first thing to do, would be to get the closest driver. A quick but not really accurate way is to get the great circle distance (either with Math or with an extension). You would probably need road KMLs for more accurate distances.

If there is a distance conflict, you could use some other metric to pick the preferred driver, or just do it randomly.

When a driver wants to cancel an order, get the coords of the client from Airtable, pick the closest driver from the list of all drivers excluding this driver, and store the new driver on the database.

Since at the same time only the client or the driver is modifying the cell, you shouldn’t have a problem with conflicts.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.