diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index cb152aad..a1a04590 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -2056,14 +2056,23 @@ class APIController extends Controller implements LoggedController // rider $rider = $jo->getRider(); + + // check if jo has rider rating set to true + $has_rider_rating = $jo->hasRiderRating(); + $rating = 0; if ($rider != null) { $jo_data['rider'] = $rider->getFullName(); + + // find the rider rating if any + if ($has_rider_rating) + $rating = $jo->getRating()->getRating(); } // rider rating for jo - $jo_data['rider_rating'] = $jo->hasRiderRating(); - + $jo_data['has_rider_rating'] = $has_rider_rating; + $jo_data['rider_rating'] = $rating; + // invoice items $items = []; $jo_items = $jo->getInvoice()->getItems(); @@ -3173,6 +3182,9 @@ class APIController extends Controller implements LoggedController $api_version = $this->getParameter('api_version'); $app_version = $req->query->get('version'); + // putting this in for the future, in case we have diverging versions + $os = $req->query->get('os'); + $platform = $req->query->get('platform'); $api_v = explode('.', $api_version); $app_v = explode('.', $app_version); diff --git a/src/Entity/Customer.php b/src/Entity/Customer.php index 4af84d96..de2cd92e 100644 --- a/src/Entity/Customer.php +++ b/src/Entity/Customer.php @@ -222,6 +222,12 @@ class Customer */ protected $car_club_customer_hub; + // ratings made by customer + /** + * @ORM\OneToMany(targetEntity="RiderRating", mappedBy="customer") + */ + protected $ratings; + public function __construct() { $this->numbers = new ArrayCollection(); @@ -259,6 +265,8 @@ class Customer $this->date_create = new DateTime(); $this->create_source = 'unknown'; + + $this->ratings = new ArrayCollection(); } public function getID() diff --git a/src/Entity/JobOrder.php b/src/Entity/JobOrder.php index fcbe5ddc..eace43a1 100644 --- a/src/Entity/JobOrder.php +++ b/src/Entity/JobOrder.php @@ -365,6 +365,12 @@ class JobOrder */ protected $delivery_status; + // rider rating + /** + * @ORM\OneToOne(targetEntity="RiderRating", mappedBy="job_order") + */ + protected $rating; + public function __construct() { $this->date_create = new DateTime(); @@ -1050,4 +1056,8 @@ class JobOrder return $this->delivery_status; } + public function getRating() + { + return $this->rating; + } } diff --git a/src/Entity/Rider.php b/src/Entity/Rider.php index 34f49455..020393da 100644 --- a/src/Entity/Rider.php +++ b/src/Entity/Rider.php @@ -136,6 +136,11 @@ class Rider */ protected $api_user; + /** + * @ORM\OneToMany(targetEntity="RiderRating", mappedBy="rider") + */ + protected $ratings; + public function __construct() { $this->job_orders = new ArrayCollection(); @@ -150,6 +155,8 @@ class Rider $this->active_job_order = null; $this->current_job_order = null; $this->api_user = null; + + $this->ratings = new ArrayCollection(); } public function getID()