fix 权重排序
This commit is contained in:
@@ -78,8 +78,11 @@ export default async function handler(
|
||||
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];
|
||||
// console.log("theChoosenUser", theChoosenUser);
|
||||
// 记录结果
|
||||
|
||||
Reference in New Issue
Block a user