diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index 50dc320d..3f5e056c 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -1095,8 +1095,15 @@ class APIController extends Controller ]); if (count($ongoing_jos) <= 0) { - // TODO: check if the latest jo they have needs rider rating - // $query = $em->createQuery('select + error_log('No pending jo'); + + // check if the latest fulfilled jo they have needs rider rating + $query = $em->createQuery('select jo from JobOrder where jo.customer = :cust and jo.status = ' . JOStatus::FULFILLED . ' order by jo.date_fulfill desc'); + $fulfill_jos = $query->setParameters([ + 'cust' => $cust + ]) + ->setMaxResults(1) + ->getResult(); // no pending $res->setData([ diff --git a/src/Entity/JobOrder.php b/src/Entity/JobOrder.php index 0e9d34e4..4a1ee90d 100644 --- a/src/Entity/JobOrder.php +++ b/src/Entity/JobOrder.php @@ -700,7 +700,7 @@ class JobOrder return $this; } - public function HasRiderRating() + public function hasRiderRating() { if ($this->flag_rider_rating == null) return false;