修复考试白名单驱动缺/待考名单:改用卷王项目参与者(Project Partners)真实模型

旧代码误读 surveySetting.whiteLists(实为题目选项白名单),导致线上从未触发。现改为读取 /api/project/partner/list 的 RESPONDENT_SYS_USER/IMP_USER 参与者作为应考名单,并保留 whiteLists 作为极老版本兜底。

dashboard.php 移除未实现的提交率卡片;全_score 默认 100 已在 data 层修正。e2e 测试 mock 与断言同步改为真实模型,全量 132 测试通过。
This commit is contained in:
2026-09-13 11:02:34 +08:00
parent 94ac381579
commit eb5d06d392
5 changed files with 133 additions and 40 deletions
+19 -4
View File
@@ -43,10 +43,7 @@ answers.push({
const SURVEY = {
id: 'root', title: '高一数学月考', type: 'survey',
surveySetting: {
// 答题白名单:待考名单来源(键为题目 ID,值为允许的答案列表;这里用学号作标识)
whiteLists: { q1: ['90001', '90002', '90003', '90004', '90005'] },
},
surveySetting: {},
children: [
{ id: 'pg1', type: 'pagination', title: '基本信息', children: [
{ id: 'q1', type: 'text', title: '<p>姓名</p>' },
@@ -63,6 +60,19 @@ const PROJECTS = [
{ id: 'p2', name: '课后满意度调查', mode: 'survey', status: 1, total: 5 },
];
// p1 的「受访者」参与者 = 应考名单(真实卷王模型:t_project_partner type=RESPONDENT_IMP_USER=3)
// status: 0未访问 / 1已访问未答 / 2已答题
const PARTNERS = {
p1: [
{ id: 'pp1', type: 3, userName: '90001', userId: '90001', status: 0 },
{ id: 'pp2', type: 3, userName: '90002', userId: '90002', status: 0 },
{ id: 'pp3', type: 3, userName: '90003', userId: '90003', status: 0 },
{ id: 'pp4', type: 3, userName: '90004', userId: '90004', status: 0 },
{ id: 'pp5', type: 3, userName: '90005', userId: '90005', status: 0 },
],
p2: [],
};
function send(res, code, obj, headers) {
res.writeHead(code, Object.assign({ 'Content-Type': 'application/json; charset=utf-8' }, headers || {}));
res.end(JSON.stringify(obj));
@@ -132,6 +142,11 @@ const server = http.createServer((req, res) => {
const slice = all.slice((cur - 1) * size, cur * size);
return send(res, 200, { code: 0, data: { total: all.length, list: slice } });
}
if (p === '/api/project/partner/list') {
const pid = u.searchParams.get('projectId');
const list = PARTNERS[pid] || [];
return send(res, 200, { code: 0, data: { total: list.length, list } });
}
return send(res, 200, { code: 404, data: null, msg: 'no route ' + p });
});