feat: 修改部分导入文本的逻辑,添加部署脚本和样式文件,更新数据库迁移逻辑

- 新增部署脚本 `build-deploy-bundle.mjs`,用于构建和部署 web 和 server 目录。
- 新增样式文件 `index-acd65452.css`,包含基础样式和响应式设计。
- 新增脚本 `repro-import-text.mjs`,用于测试文本导入 API。
- 新增测试文件 `db-migration-score-zero.test.ts`,验证历史数据库中 questions.score 约束的迁移逻辑。
- 更新数据库初始化逻辑,允许插入 score=0 的问题。
This commit is contained in:
2026-01-04 09:20:04 +08:00
parent fbfd48e0ca
commit dbf9fdc01c
26 changed files with 1420 additions and 849 deletions

View File

@@ -96,6 +96,18 @@ export class QuizController {
totalPossibleScore += Number(question.score) || 0;
if (answer.userAnswer === undefined || answer.userAnswer === null) {
answer.userAnswer = '';
}
// 规则分值为0的题目不判定正误不要求答案默认正确
if (Number(question.score) === 0) {
answer.score = 0;
answer.isCorrect = true;
processedAnswers.push(answer);
continue;
}
if (question.type === 'multiple') {
const optionCount = question.options ? question.options.length : 0;
const unitScore = optionCount > 0 ? question.score / optionCount : 0;