refactor(scheduling): condense reason text to data-only one-liner
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
kkfluous
2026-04-16 22:11:37 +08:00
parent dd03157804
commit 0a7a9a096d

View File

@@ -129,9 +129,7 @@ export function generateSuggestions(
const yearRate = vehicle.yearTarget > 0 ? Math.round((vehicle.currentYearMileage / vehicle.yearTarget) * 100) : 0; const yearRate = vehicle.yearTarget > 0 ? Math.round((vehicle.currentYearMileage / vehicle.yearTarget) * 100) : 0;
const gap = Math.max(0, vehicle.yearTarget - vehicle.currentYearMileage); const gap = Math.max(0, vehicle.yearTarget - vehicle.currentYearMileage);
const canAddKm = Math.round(customerCanAdd); const reason = `客户日均 ${Math.round(vehicle.customerAvgDaily)} km · 完成率 ${yearRate}% · 缺口 ${fmtKmSimple(gap)} km · 剩余 ${vehicle.daysLeft} 天(约 ${fmtKmSimple(Math.round(customerCanAdd))} km`;
const reason = `该车在客户「${vehicle.customer}」处日均仅 ${Math.round(vehicle.customerAvgDaily)} km完成率 ${yearRate}%,还差 ${fmtKmSimple(gap)} km年底无法达标。`
+ `\n建议将此车换走给高里程客户冲刺换上一辆快达标的车——该客户剩余 ${vehicle.daysLeft} 天还能跑约 ${fmtKmSimple(canAddKm)} km足以帮缺口小的车冲线。`;
suggestions.push({ suggestions.push({
id: `hopeless-${vehicle.plateNumber}`, id: `hopeless-${vehicle.plateNumber}`,
@@ -196,8 +194,7 @@ export function generateSuggestions(
const yearRate = vehicle.yearTarget > 0 ? Math.round((vehicle.currentYearMileage / vehicle.yearTarget) * 100) : 0; const yearRate = vehicle.yearTarget > 0 ? Math.round((vehicle.currentYearMileage / vehicle.yearTarget) * 100) : 0;
const canAddKm = vehicle.customerAvgDaily * vehicle.daysLeft; const canAddKm = vehicle.customerAvgDaily * vehicle.daysLeft;
const reason = `该车在客户「${vehicle.customer}」处已达标(完成率 ${yearRate}%客户日均 ${Math.round(vehicle.customerAvgDaily)} km × ${vehicle.daysLeft} ${fmtKmSimple(canAddKm)} km` const reason = `客户日均 ${Math.round(vehicle.customerAvgDaily)} km · 完成率 ${yearRate}% · 剩余 ${vehicle.daysLeft}(约 ${fmtKmSimple(Math.round(canAddKm))} km`;
+ `\n建议换上里程未达标的车利用该客户的高日均帮新车快速冲线。`;
suggestions.push({ suggestions.push({
id: `qualified-${vehicle.plateNumber}`, id: `qualified-${vehicle.plateNumber}`,