fix: shuffleArray bug + Playwright多轮对话测试 + 初学者考核脚本
- 修复 shuffleArray 返回新数组但调用处用 const 未接收返回值(3处) - 新增 test-multiround.mjs Playwright 多轮对话测试(简答+追问全流程) - 新增 do-assessment.mjs / check-result.mjs 考核体验脚本 - CLAUDE.md 增加 AI 工作流指令规则 - package.json 添加 playwright 依赖 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -541,8 +541,8 @@ export class QuestionBankService {
|
||||
for (const dw of dimensionWeights) {
|
||||
const dimName = dw.name as QuestionDimension;
|
||||
const targetForDim = Math.round(count * dw.weight / totalWeight);
|
||||
const pool = availableItems.filter(i => i.dimension === dimName && !usedIds.has(i.id));
|
||||
this.shuffleArray(pool);
|
||||
let pool = availableItems.filter(i => i.dimension === dimName && !usedIds.has(i.id));
|
||||
pool = this.shuffleArray(pool);
|
||||
const take = Math.min(targetForDim, pool.length);
|
||||
for (let i = 0; i < take; i++) {
|
||||
selected.push(pool[i]);
|
||||
@@ -550,7 +550,7 @@ export class QuestionBankService {
|
||||
}
|
||||
}
|
||||
availableItems = availableItems.filter(i => !usedIds.has(i.id));
|
||||
this.shuffleArray(availableItems);
|
||||
availableItems = this.shuffleArray(availableItems);
|
||||
while (selected.length < count && availableItems.length > 0) {
|
||||
const item = availableItems.pop()!;
|
||||
selected.push(item);
|
||||
@@ -572,7 +572,7 @@ export class QuestionBankService {
|
||||
if (dimIdx >= DIMENSIONS.length * 3) break;
|
||||
}
|
||||
if (selected.length < count && availableItems.length > 0) {
|
||||
this.shuffleArray(availableItems);
|
||||
availableItems = this.shuffleArray(availableItems);
|
||||
for (const item of availableItems) {
|
||||
if (selected.length >= count) break;
|
||||
if (!usedIds.has(item.id)) {
|
||||
|
||||
Reference in New Issue
Block a user