看板「改 / 新的一节 / 清掉」和后台课堂作业的增改删,前后比较学生看到的那一节, 真变了才按班推 lesson_update(加了、去掉了、语言、顺序),走学生的 /ws/config,老师不收。 没点刷新又改会合并成一条。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0fd94ee8bf
commit
df8af40d61
12 files changed
+344
-14
No files matched your search
@@ -251,6 +251,30 @@ export const classTodaySchema = z.object({
|
||||
),
|
||||
})
|
||||
|
||||
/**
|
||||
* 课上老师在看板(或后台)改了**今天这节**布置的题,推给这个班还开着页面的学生:告诉他们改了哪些,
|
||||
* 点「刷新」重新载入。只有学生看到的那一节(今天最后布置的)变了才推 —— 改的是今天早些时候的一节、
|
||||
* 或者改完和原来一样,都不推。走 /ws/config 那条全局常驻的连接。
|
||||
*
|
||||
* - `assigned`:今天这节是新布置的(原来没布置,或者「新的一节」),`problems` 是整张单子
|
||||
* - `changed`:同一节改了,看 `added` / `removed` / `languageChanged` / `reordered`
|
||||
* - `cleared`:清掉了,学生那边退回按同班提交推断
|
||||
*/
|
||||
export const lessonUpdateProblemSchema = z.object({ problemDisplayId: z.string(), title: z.string() })
|
||||
|
||||
export const lessonUpdateSchema = z.object({
|
||||
type: z.literal('lesson_update'),
|
||||
kind: z.enum(['assigned', 'changed', 'cleared']),
|
||||
language: lessonLanguageSchema,
|
||||
problems: z.array(lessonUpdateProblemSchema),
|
||||
added: z.array(lessonUpdateProblemSchema),
|
||||
removed: z.array(lessonUpdateProblemSchema),
|
||||
languageChanged: z.boolean(),
|
||||
reordered: z.boolean(),
|
||||
})
|
||||
|
||||
export type LessonUpdate = z.infer<typeof lessonUpdateSchema>
|
||||
|
||||
export type ClassActivity = z.infer<typeof classActivitySchema>
|
||||
export type ClassToday = z.infer<typeof classTodaySchema>
|
||||
export type LastVisit = z.infer<typeof lastVisitSchema>
|
||||
|
||||
Reference in new issue
Block a user