fix: require evidence for judgment answers and correct legacy banks
This commit is contained in:
@@ -39,12 +39,17 @@ function batchSource(record) {
|
||||
}
|
||||
|
||||
function selectSnapshot(input, expectedCount) {
|
||||
const batchSources = input.answerBatchSources || input.records.map(batchSource);
|
||||
if (!Array.isArray(batchSources) || batchSources.length !== input.records.length) throw new Error('原始标准答案批次证据与题目数量不一致');
|
||||
// Keep this public pure entry point fail-closed as well as the file loader.
|
||||
// Legacy list judgeAnswer 0/1 defaults are not proof of a standard answer.
|
||||
input = { ...input, records: core.repairLegacyJudgeAnswers(input.records).records };
|
||||
const names = new Set(input.records.map(record => nameKey(record.bankName)));
|
||||
if (names.size !== 1 || !expectedNames.has([...names][0])) throw new Error(`原始 CSV 必须只包含一个指定题库:${input.source.filename}`);
|
||||
const key = [...names][0], bankName = expectedNames.get(key);
|
||||
const groups = new Map();
|
||||
for (const record of input.records) {
|
||||
const source = batchSource(record);
|
||||
for (const [index, record] of input.records.entries()) {
|
||||
const source = batchSources[index]?.batchId ? batchSources[index] : batchSource(record);
|
||||
if (source?.kind !== 'network' || !source.batchId) continue;
|
||||
const time = Date.parse(source.observedAt);
|
||||
if (!Number.isFinite(time)) throw new Error(`${bankName} 批次缺少有效标准答案观察时间:${source.batchId}`);
|
||||
|
||||
Reference in New Issue
Block a user