- 流程图评到 A 或 S,记进所有已加入、且包含这道题的题单(和判题那一路同一个口径,不看从哪个 入口交的),徽章和题单类成就照样推送。原来题单进度只在判代码时记,流程图作业在题单里永远是 「没做」。流程图提交的 id 进不了 problemset_submission(外键指向代码提交表),所以只写 progress_detail —— 解锁旧提交的那道闸看的也是它 - 课堂条(/me/class-activity)的 myStatus:流程图 A / S 也算 accepted,评完的非 A/S 算 tried - 题单防抄闸门补到流程图上:加入题单之前画的图,对本人藏起来(列表 showLink、详情 404、 current / history 不数它),规则和代码提交同一份(problemSetJoinTimes 挪进 services/problemset)。 原来加入之前画到 A 的那张图点一下就能载回画布、交上去就是 A - 新增 GET /problems/:id/flowchart/scores:一次给出自己评完的每一次的分数和等级,外加被藏起来 的次数(原来 history 一次只给一条,看分数走势得一页一页翻) - 「A/S 算过关」和按分数定等级收进 flowchart/grade.ts;判题那边的记账 + 通知抽成 recordSolvedAndNotify,两条路共用 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
948e9a734d
commit
3fe3caa944
8 files changed
+280
-145
No files matched your search
@@ -17,6 +17,7 @@ import { Hono } from "hono"
|
||||
import { requireAuth, requireTeacher, type AppEnv } from "../auth/middleware"
|
||||
import { db, schema } from "../db"
|
||||
import { failure, parseBody, success } from "../http"
|
||||
import { FLOWCHART_PASS_GRADES } from "../flowchart/grade"
|
||||
import { JudgeStatus } from "../judge/status"
|
||||
import { calendarDay, dayStart, localTime } from "../time"
|
||||
import { queryInteger, rounded } from "./helpers"
|
||||
@@ -326,6 +327,29 @@ classroomRoutes.get("/me/class-activity", requireAuth, async (c) => {
|
||||
: []
|
||||
const mineById = new Map(mine.map((row) => [row.problemId, row.accepted]))
|
||||
|
||||
// 流程图作业:画到 A / S 也算做完(设计文档 2026-09-28-problem-page-redesign 第 3 节决定 6)。
|
||||
// 有的题流程图交了几百次、代码个位数,只看代码提交的话,这些学生在课堂条上永远是「没做」
|
||||
const drawn = ids.length
|
||||
? await db
|
||||
.select({
|
||||
problemId: schema.flowchartSubmission.problemId,
|
||||
passed: sql<boolean>`bool_or(${inArray(schema.flowchartSubmission.aiGrade, FLOWCHART_PASS_GRADES)})`,
|
||||
})
|
||||
.from(schema.flowchartSubmission)
|
||||
.where(
|
||||
and(
|
||||
eq(schema.flowchartSubmission.userId, user.id),
|
||||
inArray(schema.flowchartSubmission.problemId, ids),
|
||||
// 只数评完了的:评分中、评失败的那次不算「做过」
|
||||
eq(schema.flowchartSubmission.status, 2),
|
||||
),
|
||||
)
|
||||
.groupBy(schema.flowchartSubmission.problemId)
|
||||
: []
|
||||
for (const row of drawn) {
|
||||
mineById.set(row.problemId, (mineById.get(row.problemId) ?? false) || row.passed)
|
||||
}
|
||||
|
||||
return success(c, {
|
||||
className: user.className,
|
||||
day: lesson.day,
|
||||
|
||||
Reference in new issue
Block a user