任务说明:实验页"任务"面板、布置作业时可改写;先写项目 3 任务 2、项目 6 任务 2 两份

- 每个实验一份 task.md(任务目标、控件名表格、实现步骤、和书上不一样的地方、在平台上怎么试)
- 工具栏"评价项"改成"任务":上面是任务说明,下面是评价项和自己检查;不遮挡页面,第一次打开实验时自动打开
- 自己写的 Markdown 子集渲染,先转义全部 HTML(老师可以改写说明)
- 作业保存任务说明(新列 task),以前布置的作业用实验现在的说明
- 测试:任务说明表格里的控件名都在示例的 Designer.cs 里
- 修改作业时实验下拉框显示标题而不是编号

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-26 10:04:05 +08:00
1 parent 3b9f635c35
commit 90b739a2c7
17 files changed
+759 -219

No files matched your search

+23 -1
View File
@@ -9,7 +9,7 @@ import { openDatabase } from '../src/db'
import { createGradingQueue, type GradingQueue } from '../src/grading/queue'
import { languageService } from '../src/language-service'
import { sqlService } from '../src/sql-service'
import { loadSample } from '../src/samples'
import { loadSample, loadTask } from '../src/samples'
let app: ReturnType<typeof createApp>
let queue: GradingQueue
@@ -287,6 +287,28 @@ describe('作业', () => {
return { t, student, classId, assignmentId: created.body.id as number, files: template }
}
test('任务说明:布置时保存,老师可以改;没有保存的作业用实验现在的说明', async () => {
const { t, student, classId, assignmentId } = await setup()
// setup 没传任务说明(像加这个功能之前布置的作业)
expect((await student.get(`/api/assignments/${assignmentId}`)).body.assignment.task).toBe(await loadTask(SAMPLE))
await t.patch(`/api/teacher/assignments/${assignmentId}`, { title: '控制报警灯', deadline: null, scoring, task: '## 老师要求\n只做前 3 步' })
expect((await student.get(`/api/assignments/${assignmentId}`)).body.assignment.task).toBe('## 老师要求\n只做前 3 步')
const tooLong = await t.post('/api/teacher/assignments', {
classId,
sampleId: SAMPLE,
title: '太长',
startMode: 'ui',
template: [],
scoring,
deadline: null,
task: 'x'.repeat(20_001),
})
expect(tooLong.status).toBe(400)
expect(tooLong.body.message).toContain('任务说明')
})
test('分值项数要和评分规则一致', async () => {
const t = await teacher()
const classId = await classWithStudents(t, [])