feat(自学情况): 按学生加姓名/学号搜索,后端补稳定排序
Some checks failed
Deploy / deploy (push) Has been cancelled

搜索是纯前端过滤(整表本来就一次拉完),和班级筛选可以叠加。

学生查询原来没有 orderBy,前端默认按「已读」升序排之后,同分的一大批
(尤其一堆 0)落回聚合的任意顺序,刷新一次换一个样;按班级、学号兜底。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-17 02:23:01 -06:00
parent 3cc2be77a9
commit f90d01338e
2 changed files with 31 additions and 2 deletions

View File

@@ -123,7 +123,11 @@ adminLearnRoutes.get("/learn-analytics/students", requireTeacher, async (c) => {
schema.user.username,
schema.userProfile.realName,
schema.user.className,
),
)
// 前端默认按「已读」升序排,同分的一大批(尤其一堆 0就落回这里的次序。
// 不给 orderBy 的话那是聚合吐出来的任意顺序,刷一次换一个样 —— 按班级、
// 学号排稳住它。className 为空的推不出班级的ASC 默认排在最后
.orderBy(asc(schema.user.className), asc(schema.user.username)),
db
.select({
userId: schema.exerciseAttempt.userId,