feat(统计): 「今日统计」「数据统计」合成一个「统计」,打开是一行一节课,这节课在最上面
Deploy / deploy (push) Canceled after 0s

老师的提交列表上只剩一个「统计」按钮;什么都没筛时按课列(选「今天」就是原来今日统计看的),
点一行进那节课(班、题、时段都带好),左上「← 全部」回来;只填题号时仍按班级汇总,和题目页
统计页签对得上。数字行加结果条,统计里的「课堂看板」按钮去掉,改成有班正在上课时才引过去。
学生仍是「今日统计」。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-09-30 09:23:54 +08:00
1 parent 921990285c
commit e3be3cd62c
11 files changed
+891 -550

No files matched your search

+16 -1
View File
@@ -22,7 +22,11 @@ export const PERIOD_OPTIONS = [
{ label: "自己选日子", value: "custom" },
] as const
export type Period = (typeof PERIOD_OPTIONS)[number]["value"]
/**
* `lesson`:从「一行一节课」点进某一节课,from / to 是那节课第一条、最后一条提交的时刻
* (精确到毫秒,不是「自己选日子」那种按天)。它不在下拉里 —— 选中时下拉临时多出一项「那节课」
*/
export type Period = (typeof PERIOD_OPTIONS)[number]["value"] | "lesson"
export const DEFAULT_PERIOD: Period = "1h"
/** 东八区某天 0 点对应的 UTC 时刻 */
@@ -74,6 +78,14 @@ export function periodRange(period: Period, custom: [number, number] | null, now
case "term":
start = termStart(now)
break
case "lesson":
if (custom) {
start = custom[0]
end = custom[1]
} else {
start = now - HOUR
}
break
case "custom":
if (custom) {
start = custom[0]
@@ -100,6 +112,9 @@ function describe(start: number | null, end: number, period: Period) {
if (period === "1h" || period === "2h") {
return `${parseTime(new Date(start), "HH:mm")}–${parseTime(new Date(end), "HH:mm")}`
}
if (period === "lesson") {
return `${parseTime(new Date(start), "M月D日 HH:mm")}–${parseTime(new Date(end), "HH:mm")}`
}
const from = parseTime(new Date(start), "M月D日")
const to = parseTime(new Date(end - 1), "M月D日")
return from === to ? from : `${from}–${to}`