标签列表按题目数 > 0 过滤,但计数没有像 /problems 那样限制 visible=true 且非赛题,导致标签在首页出现、点进去却一道题都没有。 同时把旧仓库冻结政策收紧写进 CLAUDE.md:从今天起旧仓库零改动, 不再有内部小修的例外,所有后续工作只落在 OJ2。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -148,9 +148,16 @@ problemRoutes.get("/problems", optionalAuth, async (c) => {
|
||||
|
||||
problemRoutes.get("/problem-tags", async (c) => {
|
||||
const keyword = c.req.query("keyword")?.trim()
|
||||
// 只数公开题库里可见的题:隐藏的题和比赛题都不算,否则标签会出现在
|
||||
// 首页列表里,点进去却一道题都筛不出来(对齐 /problems 的过滤条件)
|
||||
const rows = await db.select({ id: schema.problemTag.id, name: schema.problemTag.name, problemCount: countDistinct(schema.problemTags.problemId) })
|
||||
.from(schema.problemTag)
|
||||
.innerJoin(schema.problemTags, eq(schema.problemTags.problemtagId, schema.problemTag.id))
|
||||
.innerJoin(schema.problem, and(
|
||||
eq(schema.problem.id, schema.problemTags.problemId),
|
||||
eq(schema.problem.visible, true),
|
||||
isNull(schema.problem.contestId),
|
||||
))
|
||||
.where(keyword ? ilike(schema.problemTag.name, `%${keyword}%`) : undefined)
|
||||
.groupBy(schema.problemTag.id, schema.problemTag.name).having(sql`count(${schema.problemTags.problemId}) > 0`)
|
||||
.orderBy(asc(schema.problemTag.name))
|
||||
|
||||
Reference in New Issue
Block a user