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:
@@ -306,7 +306,7 @@ export class ExamSubjectModel {
|
||||
judgment: 20,
|
||||
text: 10
|
||||
}),
|
||||
categoryRatios: parseJson<Record<string, number>>(row.categoryRatios, { 通用: 100 }),
|
||||
categoryRatios: parseJson<Record<string, number>>(row.categoryRatios, {}),
|
||||
createdAt: row.createdAt,
|
||||
updatedAt: row.updatedAt
|
||||
}));
|
||||
@@ -341,7 +341,7 @@ export class ExamSubjectModel {
|
||||
judgment: 20,
|
||||
text: 10
|
||||
}),
|
||||
categoryRatios: parseJson<Record<string, number>>(row.categoryRatios, { 通用: 100 }),
|
||||
categoryRatios: parseJson<Record<string, number>>(row.categoryRatios, {}),
|
||||
createdAt: row.createdAt,
|
||||
updatedAt: row.updatedAt
|
||||
};
|
||||
@@ -361,7 +361,7 @@ export class ExamSubjectModel {
|
||||
const timeLimitMinutes = data.timeLimitMinutes ?? 60;
|
||||
if (!Number.isInteger(timeLimitMinutes) || timeLimitMinutes <= 0) throw new Error('答题时间必须为正整数(分钟)');
|
||||
|
||||
const categoryRatios = data.categoryRatios && Object.keys(data.categoryRatios).length > 0 ? data.categoryRatios : { 通用: 100 };
|
||||
const categoryRatios = data.categoryRatios && Object.keys(data.categoryRatios).length > 0 ? data.categoryRatios : {};
|
||||
const typeRatioMode = isRatioMode(data.typeRatios as any);
|
||||
const categoryRatioMode = isRatioMode(categoryRatios);
|
||||
if (typeRatioMode !== categoryRatioMode) {
|
||||
@@ -423,7 +423,7 @@ export class ExamSubjectModel {
|
||||
const timeLimitMinutes = data.timeLimitMinutes ?? 60;
|
||||
if (!Number.isInteger(timeLimitMinutes) || timeLimitMinutes <= 0) throw new Error('答题时间必须为正整数(分钟)');
|
||||
|
||||
const categoryRatios = data.categoryRatios && Object.keys(data.categoryRatios).length > 0 ? data.categoryRatios : { 通用: 100 };
|
||||
const categoryRatios = data.categoryRatios && Object.keys(data.categoryRatios).length > 0 ? data.categoryRatios : {};
|
||||
const typeRatioMode = isRatioMode(data.typeRatios as any);
|
||||
const categoryRatioMode = isRatioMode(categoryRatios);
|
||||
if (typeRatioMode !== categoryRatioMode) {
|
||||
|
||||
Reference in New Issue
Block a user