Update: 2026-06-10 18:11:50

This commit is contained in:
Hamza-Ayed
2026-06-10 18:11:50 +03:00
parent a0473a8b0f
commit 977adfe99d
27 changed files with 3946 additions and 206 deletions

View File

@@ -96,6 +96,17 @@ try {
FROM ratingDriver
WHERE ratingDriver.driver_id = :driverID_Sub
) AS ratingDriver,
(
SELECT COUNT(*)
FROM ratingDriver
WHERE ratingDriver.driver_id = :driverID_Sub
) AS ratingCount,
(
SELECT COUNT(*)
FROM ride
WHERE ride.driver_id = :driverID_Sub
AND ride.status IN ('Finished', 'finished')
) AS completedRides,
driverToken.token AS token
@@ -143,6 +154,16 @@ try {
$finalData[$field] = $encryptionHelper->decryptData($finalData[$field]);
}
}
$ratingValue = (float) ($finalData['ratingDriver'] ?: 5.0);
$ratingCount = (int) ($finalData['ratingCount'] ?? 0);
$completedRides = (int) ($finalData['completedRides'] ?? 0);
if ($ratingValue >= 4.8 && $ratingCount >= 50 && $completedRides >= 100) {
$finalData['driverTier'] = 'Professional driver';
} elseif ($ratingValue >= 4.5 && $ratingCount >= 15 && $completedRides >= 30) {
$finalData['driverTier'] = 'Trusted driver';
} else {
$finalData['driverTier'] = 'Verified driver';
}
}
echo json_encode([
@@ -155,4 +176,4 @@ try {
http_response_code(500);
echo json_encode(["status" => "failure", "message" => "Server Error: " . $e->getMessage()]);
}
?>
?>