feat(统计): 没填班级的学生也能和班级一样看——班级下拉多一项「没填班级」,一起上的课能切出来、点进去看小方块;零散提交也能点了
- 班级筛选多一个取值 NO_CLASS("none"),统计、方块串、流程图、提交列表都认;只圈普通学生, 老师管理员的号本来就不填班级,不挡的话试题的提交会算进去 - 切课时没填班级的号合在一起当一个班切(原来 class_name is null 直接排除,7 月 4 日那两节课看不到) - 没填班级不是真班:不列「还没交」,课上只写几人不写几人之几 - 「另有零散提交」每一项可点,进那个班那一整天 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c2ef55b10b
commit
923f3efeca
10 files changed
+153
-66
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { NO_CLASS } from "@oj2/contract"
|
||||
import { parseTime } from "utils/functions"
|
||||
|
||||
/**
|
||||
@@ -30,7 +31,20 @@ export function submissionDayText(time: string) {
|
||||
return parseTime(time, "YYYY年M月D日")
|
||||
}
|
||||
|
||||
/** 班级下拉的标签:`253` → `25计算机3班`,和统计面板、班级 PK 同一个写法 */
|
||||
export function classLabel(className: string) {
|
||||
/**
|
||||
* 班级下拉的标签:`253` → `25计算机3班`,和统计面板、班级 PK 同一个写法。
|
||||
* null(接口里没填班级的号)和 NO_CLASS(筛选里的「没填班级」)都写成「没填班级」
|
||||
*/
|
||||
export function classLabel(className: string | null) {
|
||||
if (className === null || className === NO_CLASS) return "没填班级"
|
||||
return `${className.slice(0, 2)}计算机${className.slice(2)}班`
|
||||
}
|
||||
|
||||
/**
|
||||
* 班级下拉的选项:配置里的班,最后一项「没填班级」(这批号也要能和普通班一样圈出来看)。
|
||||
* 带进来的班不在配置里(老班、手打的)也要显示得出来,不然框里是空的却在筛
|
||||
*/
|
||||
export function classSelectOptions(list: string[], current: string) {
|
||||
const all = current && current !== NO_CLASS && !list.includes(current) ? [current, ...list] : list
|
||||
return [...all, NO_CLASS].map((item) => ({ label: classLabel(item), value: item }))
|
||||
}
|
||||
Reference in new issue
Block a user