feat(布置作业): 能布置「画流程图」「先画再写」,看板分清卡在画图还是写代码
Deploy / deploy (push) Canceled after 0s

布置时多一个「做什么」:写代码 / 先画再写 / 画流程图(只能选打开了画流程图的题)。
- 先画再写:一道题图画到 A/S、代码也交对才算做完;学生画一道写一道、全画完再写都行,
  打开题目自动停在该做的那一步(图没画对停画布,画对了换到布置的语言)
- 也能分开布置:先一节画流程图,看板上「用这几道题写代码」再开一节;学生那边把今天
  几节课的要求合起来,还没画完的照样看得到要画
- 看板格子是一条进度:图 1/6 → 空心「图 ✓」→ 代码 ✗ → ✓,先写代码没画图的写「缺图」;
  卡在画图上的点开讲那张图(要改的框标红 + AI 的哪里错/怎么改),按走对几组归堆
- 写代码的课不再拿画对的流程图顶替做完;数据统计里画流程图的课数流程图提交

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-11-02 21:50:48 +08:00
1 parent 71323d9b63
commit 38a331c2b7
33 files changed
+4987 -209

No files matched your search

+8
View File
@@ -81,6 +81,11 @@ function lessonLanguageFilter(raw: string | undefined) {
return language ? sql`${schema.problem.languages} @> ${JSON.stringify([language])}::jsonb` : undefined
}
/** 要画流程图的课(`?flowchart=1`):只列打开了「让学生自己画」的题,没打开的学生那边没有画布 */
function lessonFlowchartFilter(raw: string | undefined) {
return raw === '1' ? eq(schema.problem.allowFlowchart, true) : undefined
}
type ProblemStates = Awaited<ReturnType<typeof problemStates>> | null
type UserCounts = Awaited<ReturnType<typeof problemUserCounts>>
@@ -149,6 +154,8 @@ problemRoutes.get('/problems', optionalAuth, async (c) => {
if (byType) filters.push(byType)
const byLanguage = lessonLanguageFilter(c.req.query('language'))
if (byLanguage) filters.push(byLanguage)
const byFlowchart = lessonFlowchartFilter(c.req.query('flowchart'))
if (byFlowchart) filters.push(byFlowchart)
const states = user ? await problemStates(user.id) : null
if (undone && states && states.solved.size > 0) filters.push(notInArray(schema.problem.id, [...states.solved]))
@@ -226,6 +233,7 @@ problemRoutes.get('/problem-tags', async (c) => {
eq(schema.problem.visible, true),
isNull(schema.problem.contestId),
lessonLanguageFilter(c.req.query('language')),
lessonFlowchartFilter(c.req.query('flowchart')),
),
)
.where(keyword ? ilike(schema.problemTag.name, `%${keyword}%`) : undefined)