Skip to content

Commit

Permalink
fix(script): 修复手贱导致的判断题乱选的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Apr 20, 2023
1 parent 5de62f5 commit 4cfa3c8
Showing 1 changed file with 11 additions and 21 deletions.
32 changes: 11 additions & 21 deletions packages/core/src/core/worker/question.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,23 +179,7 @@ export function defaultQuestionResolve<E>(
/** 判断题处理器 */
async judgement(infos, options, handler) {
for (const answers of infos.map((info) => info.results.map((res) => res.answer))) {
const correctWords = [
'是',
'对',
'正确',
'确定',
'√',
'对的',
'是的',
'正确的',
'true',
'True',
'yes',
'1',
'✔️',
'☑️',
'✅'
];
const correctWords = ['是', '对', '正确', '确定', '√', '对的', '是的', '正确的', 'true', 'True', 'yes', '1'];
const incorrectWords = [
'非',
'否',
Expand All @@ -212,10 +196,7 @@ export function defaultQuestionResolve<E>(
'false',
'False',
'no',
'0',
'✖️',
'❎',
'❌'
'0'
];

/** 答案显示正确 */
Expand All @@ -230,6 +211,15 @@ export function defaultQuestionResolve<E>(
const textShowCorrect = matches(el.innerText, correctWords);
/** 选项显示错误 */
const textShowIncorrect = matches(el.innerText, incorrectWords);

console.log({
el: el.innerText,
answerShowCorrect,
textShowCorrect,
answerShowIncorrect,
textShowIncorrect
});

if (answerShowCorrect && textShowCorrect) {
option = el;
await handler('judgement', answerShowCorrect, el, ctx);
Expand Down

0 comments on commit 4cfa3c8

Please sign in to comment.