Yesterday I tracked down two bugs in LawnPro’s route planner that had been bothering me for hours.
The first appeared when a customer call was marked as a locked finish. Occasionally, the trip with a distance of zero failed to become the start of the route, and the route numbers ended up out of sequence.
The cause was a small but consequential piece of Visual FoxPro code: I was using LOCATE() as though it returned a true or false result for the matching record. The correct approach was to run LOCATE FOR lSelected .AND. Locked and then check FOUND(). Once I changed that, the planner could reliably tell whether a locked finish existed.
The second bug took a different route to reveal itself. If I built a route of five calls and removed the last call repeatedly, I could eventually end up with two finish points. That gave me a repeatable way to follow what happened as the route shrank and correct the finish-point handling.
Neither bug looked dramatic on screen. That’s often the difficult part of this work: a route can look almost right while one flag or one record is out of place.
Finding both in one session was satisfying. More importantly, the planner now behaves properly when someone changes their mind about the last stop — which is exactly what real users do.