fix(题目列表): 选了知识点后题目改成按题号排,和平时看惯的「最新的在前」不一样——默认一律按最新创建

排序下拉固定三项:最新创建(默认)/ 按题号 / 最多人做对。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-09 12:57:14 +08:00
1 parent 74af88046e
commit 97426f0895
3 files changed
+10 -13

No files matched your search

+3 -3
View File
@@ -169,10 +169,10 @@ problemRoutes.get("/problems", optionalAuth, async (c) => {
filters.push(notInArray(schema.problem.id, [...states.solved]))
const where = and(...filters)
// 默认:选了知识点按题号(同一系列的题挨在一起),全部题目按最新创建。
// 旧的排序值(最多提交、画流程图……)落到默认 —— 类型已经拆成了单独的筛选
// 默认按最新创建(选了知识点也一样)。旧的排序值(最多提交、画流程图……)落到默认 ——
// 类型已经拆成了单独的筛选
const sort = problemListSortSchema.safeParse(c.req.query("sort") ?? "").data ?? ""
const effective = sort || (tag ? "id" : "new")
const effective = sort || "new"
const allCounts = effective === "popular" ? await problemUserCounts() : null
const popularity = allCounts
? sql`case ${schema.problem.id} ${sql.join(