看板格子的次数原来是代码和流程图加在一起的,链接却总是去代码那边;名字链接看的「今天交过」 还把比赛提交算了进去。现在格子分开给代码 / 流程图次数、学生分开给今天交过代码 / 画过流程图, 只画了流程图的跳到提交列表的「流程图」那边。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
52bf2d6111
commit
923516ad36
3 files changed
+50
-8
No files matched your search
@@ -560,6 +560,10 @@ classroomRoutes.get("/classroom/board", requireTeacher, async (c) => {
|
||||
.select({
|
||||
userId: schema.submission.userId,
|
||||
lastAt: sql<string>`max(${schema.submission.createTime})`,
|
||||
// 非比赛的最后一次,给「点名字跳提交列表」判断用(列表只列非比赛的)
|
||||
lastPublicAt: sql<
|
||||
string | null
|
||||
>`max(${schema.submission.createTime}) filter (where ${isNull(schema.submission.contestId)})`,
|
||||
})
|
||||
.from(schema.submission)
|
||||
.where(
|
||||
@@ -625,6 +629,10 @@ classroomRoutes.get("/classroom/board", requireTeacher, async (c) => {
|
||||
const cellByKey = new Map(cells.map((row) => [`${row.userId}:${row.problemId}`, row]))
|
||||
const drawnByKey = new Map(drawn.map((row) => [`${row.userId}:${row.problemId}`, row]))
|
||||
const lastByUser = new Map(lastSubmits.map((row) => [row.userId, row.lastAt]))
|
||||
const codeTodayUsers = new Set(
|
||||
lastSubmits.filter((row) => row.lastPublicAt).map((row) => row.userId),
|
||||
)
|
||||
const drawnTodayUsers = new Set(lastDrawn.map((row) => row.userId))
|
||||
for (const row of lastDrawn) {
|
||||
const known = lastByUser.get(row.userId)
|
||||
if (!known || Date.parse(row.lastAt) > Date.parse(known)) lastByUser.set(row.userId, row.lastAt)
|
||||
@@ -656,10 +664,14 @@ classroomRoutes.get("/classroom/board", requireTeacher, async (c) => {
|
||||
return {
|
||||
status: !cell && !flow ? "none" : acceptedAt ? "accepted" : "tried",
|
||||
attempts: (cell?.attempts ?? 0) + (flow?.attempts ?? 0),
|
||||
codeAttempts: cell?.attempts ?? 0,
|
||||
flowchartAttempts: flow?.attempts ?? 0,
|
||||
acceptedAt,
|
||||
}
|
||||
}),
|
||||
lastSubmitAt: lastByUser.get(student.userId) ?? null,
|
||||
codeToday: codeTodayUsers.has(student.userId),
|
||||
drawnToday: drawnTodayUsers.has(student.userId),
|
||||
recentAttended: attendedByUser.get(student.userId) ?? 0,
|
||||
}) satisfies ClassBoardStudent,
|
||||
),
|
||||
|
||||
@@ -224,16 +224,24 @@ const GROUP_LABEL: Record<
|
||||
const router = useRouter()
|
||||
|
||||
/**
|
||||
* 点格子 / 名字到提交列表看他今天交的代码。新标签打开:看板多半正投在屏幕上,别把它顶掉。
|
||||
* 用户名按整名匹配(学号互相包含是常态,ks24a1 会混进 ks24a10)
|
||||
* 点格子 / 名字到提交列表看他今天交的。新标签打开:看板多半正投在屏幕上,别把它顶掉。
|
||||
* 用户名按整名匹配(学号互相包含是常态,ks24a1 会混进 ks24a10)。
|
||||
*
|
||||
* 今天只画了流程图、没写代码的,跳到列表的「流程图」那边 —— 不然这节课整班在画流程图时,
|
||||
* 点进去是一片「没有符合条件的提交」
|
||||
*/
|
||||
function submissionsHref(student: ClassBoardStudent, problemDisplayId?: string) {
|
||||
function submissionsHref(
|
||||
student: ClassBoardStudent,
|
||||
problemDisplayId: string | undefined,
|
||||
flowchart: boolean,
|
||||
) {
|
||||
return router.resolve({
|
||||
name: "submissions",
|
||||
query: {
|
||||
username: student.username,
|
||||
exactUsername: "1",
|
||||
today: "1",
|
||||
...(flowchart ? { language: "Flowchart" } : {}),
|
||||
...(problemDisplayId ? { problem: problemDisplayId } : {}),
|
||||
},
|
||||
}).href
|
||||
@@ -401,9 +409,9 @@ function submissionsHref(student: ClassBoardStudent, problemDisplayId?: string)
|
||||
<tr v-for="student in students" :key="student.userId">
|
||||
<td class="name">
|
||||
<a
|
||||
v-if="student.lastSubmitAt"
|
||||
v-if="student.codeToday || student.drawnToday"
|
||||
class="cell-link"
|
||||
:href="submissionsHref(student)"
|
||||
:href="submissionsHref(student, undefined, !student.codeToday)"
|
||||
target="_blank"
|
||||
:title="`看 ${nameOf(student)} 今天交的全部`"
|
||||
>
|
||||
@@ -432,9 +440,19 @@ function submissionsHref(student: ClassBoardStudent, problemDisplayId?: string)
|
||||
<a
|
||||
v-if="cell.attempts"
|
||||
class="cell-link"
|
||||
:href="submissionsHref(student, board.problems[i]!.problemDisplayId)"
|
||||
:href="
|
||||
submissionsHref(
|
||||
student,
|
||||
board.problems[i]!.problemDisplayId,
|
||||
!cell.codeAttempts,
|
||||
)
|
||||
"
|
||||
target="_blank"
|
||||
:title="`看 ${nameOf(student)} 今天在这道题上交的 ${cell.attempts} 次`"
|
||||
:title="
|
||||
cell.codeAttempts
|
||||
? `看 ${nameOf(student)} 今天在这道题上交的 ${cell.codeAttempts} 次代码`
|
||||
: `看 ${nameOf(student)} 今天在这道题上画的 ${cell.flowchartAttempts} 张流程图`
|
||||
"
|
||||
>
|
||||
{{ cellText(cell) }}
|
||||
</a>
|
||||
|
||||
Reference in new issue
Block a user