Update: 2026-08-07 02:10:33
This commit is contained in:
@@ -104,14 +104,25 @@ function dispatchScoreDriver(array $driver, array $signals): float
|
||||
// توافقاً مؤكداً لا مجرد احتمال.
|
||||
$destinationFit = !empty($driver['has_destination']) ? 1.0 : 0.5;
|
||||
|
||||
return round(
|
||||
(0.40 * $proximity)
|
||||
$score = (0.40 * $proximity)
|
||||
+ (0.20 * $acceptRate)
|
||||
+ (0.15 * $rating)
|
||||
+ (0.15 * $idle)
|
||||
+ (0.10 * $destinationFit),
|
||||
4
|
||||
);
|
||||
+ (0.10 * $destinationFit);
|
||||
|
||||
// ── عقوبة التسرب خارج المنصة ──
|
||||
// يحسبها bot/cron_leak_detection.php من نمط: قَبِل ← أُلغيت ← لم تبدأ،
|
||||
// مع تكرار نفس زوج (سائق، راكب). ليست حظراً بل خفض أولوية: السائق
|
||||
// يخسر السبق والرحلات الأقرب تدريجياً — موجع بلا حرمان، ويتراجع من
|
||||
// نفسه حين ينظف سجله لأن الكرون يحذف الحقل خارج النافذة.
|
||||
//
|
||||
// تُطرح من الدرجة لا تُضرب فيها: الضرب كان سيبقي السائق الأقرب
|
||||
// متقدّماً رغم عقوبته، والطرح يزيحه فعلاً عن رأس القائمة.
|
||||
$leakPenalty = isset($signals['leak_penalty'])
|
||||
? max(0.0, min(1.0, (float) $signals['leak_penalty']))
|
||||
: 0.0;
|
||||
|
||||
return round(max(0.0, $score - (0.35 * $leakPenalty)), 4);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,6 +157,7 @@ function dispatchReadSignals($redisLocation, array $driverIds): array
|
||||
'idle_seconds' => isset($row['last_ride_end'])
|
||||
? max(0, time() - (int) $row['last_ride_end'])
|
||||
: 0,
|
||||
'leak_penalty' => $row['leak_penalty'] ?? null,
|
||||
];
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
|
||||
Reference in New Issue
Block a user