fix 权重排序
This commit is contained in:
@@ -78,8 +78,11 @@ export default async function handler(
|
|||||||
counts[smallestIndex][user][smallestIndex],
|
counts[smallestIndex][user][smallestIndex],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
weightList.sort((a, b) => a[1] - b[1] || a[2] - b[2]);
|
// 相同工时数量、相同权重的情况下随机选择
|
||||||
// console.log("weightList", weightList);
|
weightList.sort(
|
||||||
|
(a, b) => a[1] - b[1] || b[2] - a[2] || Math.random() - 0.5
|
||||||
|
);
|
||||||
|
console.log("weightList", smallestIndex, weightList);
|
||||||
const theChoosenUser = weightList[0][0];
|
const theChoosenUser = weightList[0][0];
|
||||||
// console.log("theChoosenUser", theChoosenUser);
|
// console.log("theChoosenUser", theChoosenUser);
|
||||||
// 记录结果
|
// 记录结果
|
||||||
|
|||||||
Reference in New Issue
Block a user