fix(年度趋势): 刚学一个月的届不再拿去和学了一年多的往届比,两边都只算同样学了这么久时做的
Deploy / deploy (push) Canceled after 0s

以前往届那一侧把所有记录都算进去,25 级比 24 级显示 73% / 82%,
其实 24 级在这些题上近一半是学了半年以上才做的;同期比是 73% / 75%。

现在每个人以自己第一次交题为起点,两边都只算离起点不超过 N 天的人题对,
N = 两届里学得短的那届一半人开始做题到现在的天数。按人不按日历,因为各届
开始做题的时间不一样(25 级第二年才开始)。比哪届改成后端算,接口带 grade / compare。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-20 21:21:22 +08:00
1 parent e3c0507d41
commit f7c4af0c01
5 files changed
+176 -98

No files matched your search

+22 -8
View File
@@ -647,13 +647,27 @@ export const stuckProblemDetailSchema = z.object({
),
})
/** 年度趋势:一道题在各届(班号前两位)的「一次就对」,只给至少 5 人做过的格子 */
export const gradeTrendProblemSchema = z.object({
id: z.number().int(),
displayId: z.string(),
title: z.string(),
grades: z.array(
z.object({ grade: z.string(), users: z.number().int(), firstTry: z.number().int() }),
const gradeTrendSideSchema = z.object({ users: z.number().int(), firstTry: z.number().int() })
/**
* 年度趋势:选中的一届(grade)和往届或另一届(compare)在两边都做过的题上逐题比「一次就对」。
* `days` 是同期窗口:两边都只算「第一次交这道题时,离他自己第一次交题不超过这么多天」的人题对;
* 两边的数据都没超出窗口时为 null(= 全部)。
*/
export const gradeTrendSchema = z.object({
/** 有数据的届,新的在前 */
grades: z.array(z.string()),
grade: z.string(),
compare: z.string(),
days: z.number().int().nullable(),
problems: z.array(
z.object({
id: z.number().int(),
displayId: z.string(),
title: z.string(),
mine: gradeTrendSideSchema,
theirs: gradeTrendSideSchema,
}),
),
})
@@ -1149,7 +1163,7 @@ export type AdminAiReportList = z.infer<typeof adminAiReportListSchema>
export type StuckProblem = z.infer<typeof stuckProblemSchema>
export type StuckStudent = z.infer<typeof stuckStudentSchema>
export type StuckProblemDetail = z.infer<typeof stuckProblemDetailSchema>
export type GradeTrendProblem = z.infer<typeof gradeTrendProblemSchema>
export type GradeTrend = z.infer<typeof gradeTrendSchema>
export type LearnBoard = z.infer<typeof learnBoardSchema>
export type LearnBoardStudent = z.infer<typeof learnBoardStudentSchema>
export type LearnExerciseProgress = z.infer<typeof learnExerciseProgressSchema>