revert(提交列表): 撤掉班级下拉里补「近半年有提交的班」那一版,下拉回到只用系统设定的班级列表
改成在右栏名字旁加「只看这个班」过滤按钮(下一条)。
This reverts commit 61ec7d7.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
61ec7d7f8e
commit
e37ad982c0
3 files changed
+3
-61
No files matched your search
@@ -208,36 +208,6 @@ submissionRoutes.get("/submissions/today-count", async (c) => {
|
||||
return success(c, row?.value ?? 0)
|
||||
})
|
||||
|
||||
/**
|
||||
* 近半年交过代码或流程图的班级,给提交列表的班级下拉补上网站配置里没有的那些。
|
||||
* 配置的班级列表管的是「注册时能选哪些班」,毕业、换届的班从里面摘掉之后
|
||||
* 还在交(生产上 247 摘了之后四个月里交了三百多条),下拉里却选不到它。
|
||||
* 只收 3~4 位数字的班级号,`user.class_name` 里有几个手填的名字不算班。
|
||||
*/
|
||||
submissionRoutes.get("/submissions/classes", requireTeacher, async (c) => {
|
||||
const since = new Date(Date.now() - 180 * 24 * 3600 * 1000).toISOString()
|
||||
const active = db
|
||||
.selectDistinct({ userId: schema.submission.userId })
|
||||
.from(schema.submission)
|
||||
.where(
|
||||
and(isNull(schema.submission.contestId), sql`${schema.submission.createTime} >= ${since}`),
|
||||
)
|
||||
.union(
|
||||
db
|
||||
.selectDistinct({ userId: schema.flowchartSubmission.userId })
|
||||
.from(schema.flowchartSubmission)
|
||||
.where(sql`${schema.flowchartSubmission.createTime} >= ${since}`),
|
||||
)
|
||||
.as("active")
|
||||
const rows = await db
|
||||
.selectDistinct({ className: schema.user.className })
|
||||
.from(active)
|
||||
.innerJoin(schema.user, eq(schema.user.id, active.userId))
|
||||
.where(sql`${schema.user.className} ~ '^[0-9]{3,4}$'`)
|
||||
.orderBy(schema.user.className)
|
||||
return success(c, rows.map((row) => row.className!) satisfies string[])
|
||||
})
|
||||
|
||||
submissionRoutes.route("/", submissionStatisticsRoutes)
|
||||
|
||||
// 老师也能重判:旧栈只给超管,前端却一直给老师亮着按钮,老师点了只会「权限不足」。
|
||||
|
||||
Reference in new issue
Block a user