学生拿不到 info(每个点带 output_md5,只给管理员),测试点表格从来只有管理员看得见, 学生这边只有一句「答案错误」—— 从 2/8 交到 6/8 的人,感受是连输五次。 - 提交详情新增 caseSummary,后端从 info 数出通过数下发,不放开原文。 比赛提交、SQL 题(被杀的测试点会 break,total 偏小)、无逐点结果时为 null - 结果面板标题缀上通过数并加进度条,提交详情页标题同步;一个都没过时不缀 - POST /ai/hint 对编译失败跳过失败次数门槛,throttleAi 照旧;前端显示条件同口径 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013TecwAowmYcoNZRheSyTgH
This commit is contained in:
1 parent
a833819679
commit
9132901cc7
7 files changed
+85
-9
No files matched your search
@@ -1,8 +1,8 @@
|
||||
import { toAdminType } from "@oj2/contract"
|
||||
import type { JudgeCaseResult, JudgeInfo } from "@oj2/contract"
|
||||
import { getTime, intervalToDuration, parseISO, type Duration } from "date-fns"
|
||||
import { User } from "./types"
|
||||
import { USER_TYPE } from "./constants"
|
||||
import { Submission, User } from "./types"
|
||||
import { JUDGE_STATUS, USER_TYPE } from "./constants"
|
||||
import {
|
||||
strFromU8,
|
||||
strToU8,
|
||||
@@ -37,6 +37,32 @@ export function submissionCaseResults(info: unknown): JudgeCaseResult[] {
|
||||
return Array.isArray(data) ? data : []
|
||||
}
|
||||
|
||||
/**
|
||||
* 没通过、但已经过了一部分测试点时的进度,其余情况(通过、一个都没过、没有逐点结果)为 null。
|
||||
*
|
||||
* 一个都没过不给:「通过 0/8」只是把「答案错误」换个更刺眼的说法再说一遍。
|
||||
* 全过也不给:AC 用不着;AST_CHECK_FAILED 是测试点全过、语法规则没过,那边有自己的规则清单。
|
||||
*/
|
||||
export function submissionPartialCases(
|
||||
submission: Pick<Submission, "caseSummary"> | undefined,
|
||||
) {
|
||||
const summary = submission?.caseSummary
|
||||
if (!summary || summary.passed === 0 || summary.passed >= summary.total)
|
||||
return null
|
||||
return summary
|
||||
}
|
||||
|
||||
/** 结果标题:部分测试点通过时缀上「通过 x/y 个测试点」 */
|
||||
export function submissionResultTitle(
|
||||
submission: Pick<Submission, "result" | "caseSummary">,
|
||||
) {
|
||||
const title = JUDGE_STATUS[submission.result]["title"]
|
||||
const partial = submissionPartialCases(submission)
|
||||
return partial
|
||||
? `${title} · 通过 ${partial.passed}/${partial.total} 个测试点`
|
||||
: title
|
||||
}
|
||||
|
||||
export function getACRate(acCount: number, totalCount: number): string {
|
||||
return `${calculateACRate(acCount, totalCount)}%`
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user