Clear rider when JO has been rejected. Send event for rider availability when rider rejects JO. #437
This commit is contained in:
parent
95a070051e
commit
109911bbb0
1 changed files with 11 additions and 1 deletions
|
|
@ -976,7 +976,7 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
|
||||||
|
|
||||||
$jo->requeue();
|
$jo->requeue();
|
||||||
|
|
||||||
// TODO: do we leave JO as assigned to rider?
|
$jo->clearRider();
|
||||||
|
|
||||||
// add event log
|
// add event log
|
||||||
$rider = $this->session->getRider();
|
$rider = $this->session->getRider();
|
||||||
|
|
@ -987,6 +987,9 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
|
||||||
->setRider($rider);
|
->setRider($rider);
|
||||||
$this->em->persist($event);
|
$this->em->persist($event);
|
||||||
|
|
||||||
|
// set rider's active JO to null
|
||||||
|
$rider->setActiveJobOrder();
|
||||||
|
|
||||||
$this->em->flush();
|
$this->em->flush();
|
||||||
|
|
||||||
// send mqtt event
|
// send mqtt event
|
||||||
|
|
@ -997,6 +1000,13 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
|
||||||
];
|
];
|
||||||
$this->mclient->sendEvent($jo, $payload);
|
$this->mclient->sendEvent($jo, $payload);
|
||||||
|
|
||||||
|
// need to send another mqtt event saying rider is available
|
||||||
|
// to change icon on dashboard
|
||||||
|
$channel = 'rider/' . $rider->getID() . '/status';
|
||||||
|
$rider_status = 'available';
|
||||||
|
|
||||||
|
$this->mclient->publish($channel, $rider_status);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue