布置时多一个「做什么」:写代码 / 先画再写 / 画流程图(只能选打开了画流程图的题)。 - 先画再写:一道题图画到 A/S、代码也交对才算做完;学生画一道写一道、全画完再写都行, 打开题目自动停在该做的那一步(图没画对停画布,画对了换到布置的语言) - 也能分开布置:先一节画流程图,看板上「用这几道题写代码」再开一节;学生那边把今天 几节课的要求合起来,还没画完的照样看得到要画 - 看板格子是一条进度:图 1/6 → 空心「图 ✓」→ 代码 ✗ → ✓,先写代码没画图的写「缺图」; 卡在画图上的点开讲那张图(要改的框标红 + AI 的哪里错/怎么改),按走对几组归堆 - 写代码的课不再拿画对的流程图顶替做完;数据统计里画流程图的课数流程图提交 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
71323d9b63
commit
38a331c2b7
33 files changed
+4987
-209
No files matched your search
@@ -34,6 +34,7 @@ adminLessonRoutes.get('/lessons', requireTeacher, async (c) => {
|
||||
day: schema.classLesson.day,
|
||||
problemIds: schema.classLesson.problemIds,
|
||||
language: schema.classLesson.language,
|
||||
mode: schema.classLesson.mode,
|
||||
createdAt: schema.classLesson.createdAt,
|
||||
updatedAt: schema.classLesson.updatedAt,
|
||||
createdBy: teacherName,
|
||||
@@ -85,6 +86,7 @@ adminLessonRoutes.get('/lessons', requireTeacher, async (c) => {
|
||||
updatedAt: row.updatedAt,
|
||||
createdBy: row.createdBy,
|
||||
language: row.language ?? null,
|
||||
mode: row.mode,
|
||||
// 题被删掉的(problem_ids 不挂外键)直接不列
|
||||
problems: row.problemIds.flatMap((id) => {
|
||||
const problem = problemById.get(id)
|
||||
@@ -98,23 +100,33 @@ adminLessonRoutes.get('/lessons', requireTeacher, async (c) => {
|
||||
} satisfies AdminLessonList)
|
||||
})
|
||||
|
||||
/** 新补一节、改一节共用的校验:班得有人、题号都对得上、语言每道都能交 */
|
||||
async function lessonValues(
|
||||
body: AdminLessonRequest,
|
||||
): Promise<
|
||||
/** 新补一节、改一节共用的校验:班得有人、题号都对得上、语言每道都能交、要画的都打开了画流程图 */
|
||||
async function lessonValues(body: AdminLessonRequest): Promise<
|
||||
| { code: string; message: string }
|
||||
| { values: { className: string; day: string; problemIds: number[]; language: AdminLessonRequest['language']; createdAt: string } }
|
||||
| {
|
||||
values: {
|
||||
className: string
|
||||
day: string
|
||||
problemIds: number[]
|
||||
language: AdminLessonRequest['language']
|
||||
mode: AdminLessonRequest['mode']
|
||||
createdAt: string
|
||||
}
|
||||
}
|
||||
> {
|
||||
const [exists] = await db.select({ id: schema.user.id }).from(schema.user).where(eq(schema.user.className, body.className)).limit(1)
|
||||
if (!exists) return { code: 'class-not-found', message: `没有 ${body.className} 这个班` }
|
||||
const resolved = await resolveLessonProblems(body.problemDisplayIds, body.language)
|
||||
// 只画流程图不用语言,存成 null(和看板布置一样)
|
||||
const language = body.mode === 'flowchart' ? null : body.language
|
||||
const resolved = await resolveLessonProblems(body.problemDisplayIds, language, body.mode)
|
||||
if ('code' in resolved) return resolved
|
||||
return {
|
||||
values: {
|
||||
className: body.className,
|
||||
day: body.day,
|
||||
problemIds: resolved.problemIds,
|
||||
language: body.language,
|
||||
language,
|
||||
mode: body.mode,
|
||||
createdAt: localDateTime(body.day, body.time),
|
||||
},
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user