Fix available rider filter to also consider flag_active and current_job_order #800
This commit is contained in:
parent
44b3753ece
commit
e8b14ff379
2 changed files with 7 additions and 3 deletions
|
|
@ -114,7 +114,9 @@ class Hub
|
||||||
public function getAvailableRiders()
|
public function getAvailableRiders()
|
||||||
{
|
{
|
||||||
$crit = Criteria::create();
|
$crit = Criteria::create();
|
||||||
$crit->where(Criteria::expr()->eq('flag_available', true));
|
$crit->where(Criteria::expr()->eq('flag_available', true))
|
||||||
|
->where(Criteria::expr()->eq('flag_active', true))
|
||||||
|
->where(Criteria::expr()->eq('current_job_order', null));
|
||||||
|
|
||||||
return $this->riders->matching($crit);
|
return $this->riders->matching($crit);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class RiderAvailabilityHubFilter extends BaseHubFilter implements HubFilterInter
|
||||||
|
|
||||||
// check customer class
|
// check customer class
|
||||||
if (!empty($params['customer_class']) && $params['customer_class'] == CustomerClassification::VIP) {
|
if (!empty($params['customer_class']) && $params['customer_class'] == CustomerClassification::VIP) {
|
||||||
error_log("INVENTORY CHECK " . $this->getJOID() . ": VIP CLASS");
|
error_log("RIDER CHECK " . $this->getJOID() . ": VIP CLASS");
|
||||||
return $hubs;
|
return $hubs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -40,8 +40,10 @@ class RiderAvailabilityHubFilter extends BaseHubFilter implements HubFilterInter
|
||||||
foreach ($hubs as $hub_data) {
|
foreach ($hubs as $hub_data) {
|
||||||
$hub = $hub_data['hub'];
|
$hub = $hub_data['hub'];
|
||||||
|
|
||||||
|
$available_riders = count($hub->getAvailableRiders());
|
||||||
// check we have available riders
|
// check we have available riders
|
||||||
if ($hub->getAvailableRiders() === 0) {
|
error_log("TOTAL RIDERS: " . $available_riders);
|
||||||
|
if ($available_riders === 0) {
|
||||||
// if we have a JO, create rejection record and notify
|
// if we have a JO, create rejection record and notify
|
||||||
if (!empty($jo_id)) {
|
if (!empty($jo_id)) {
|
||||||
// create rejection report entry
|
// create rejection report entry
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue