onsite-toolkit: skip CE

This commit is contained in:
undefined committed 2024-11-23 10:57:00 +08:00
1 parent 45fe2d81d6
commit 979f68a47e
2 files changed
+16 -11

No files matched your search

@@ -38,6 +38,8 @@ interface ProblemStatus {
frozen: number; frozen: number;
pass: boolean; pass: boolean;
time: number; time: number;
index: number;
id?: string;
} }
function status(problem: ProblemStatus) { function status(problem: ProblemStatus) {
@@ -72,9 +74,10 @@ export function start(data: ResolverInput, options: DisplaySettings) {
pass: false, pass: false,
id: problem.id, id: problem.id,
index: idx, index: idx,
time: 0,
})), })),
})); }));
const allSubmissions = data.submissions.sort((a, b) => a.time - b.time); const allSubmissions = data.submissions.filter((i) => !['CE', 'SE', 'FE', 'IGN'].includes(i.verdict)).sort((a, b) => a.time - b.time);
const allAc = allSubmissions.filter((i) => i.verdict === 'AC'); const allAc = allSubmissions.filter((i) => i.verdict === 'AC');
for (const submission of allSubmissions) { for (const submission of allSubmissions) {
const team = teams.find((v) => v.id === submission.team); const team = teams.find((v) => v.id === submission.team);
@@ -137,7 +140,7 @@ export function start(data: ResolverInput, options: DisplaySettings) {
}, },
async revealProblem(teamId: string, problemId: string) { async revealProblem(teamId: string, problemId: string) {
const team = teams.find((i) => i.id === teamId); const team = teams.find((i) => i.id === teamId);
const problem: ProblemStatus = team?.problems.find((i) => i.id === problemId); const problem = team?.problems.find((i) => i.id === problemId);
if (!team || !problem) return; if (!team || !problem) return;
if (allAc.find((s) => s.team === teamId && s.problem === problemId)) { if (allAc.find((s) => s.team === teamId && s.problem === problemId)) {
const sub = allSubmissions.filter((s) => s.team === teamId && s.problem === problemId); const sub = allSubmissions.filter((s) => s.team === teamId && s.problem === problemId);
@@ -145,10 +148,10 @@ export function start(data: ResolverInput, options: DisplaySettings) {
for (const s of sub) { for (const s of sub) {
problem.old++; problem.old++;
if (s.verdict !== 'AC') { if (s.verdict !== 'AC') {
penalty += 20 * 60; penalty += 20;
} else { } else {
problem.time = Math.floor(s.time / 60); problem.time = Math.floor(s.time / 60);
penalty += s.time; penalty += Math.floor(s.time / 60);
break; break;
} }
} }
@@ -199,10 +202,10 @@ export function start(data: ResolverInput, options: DisplaySettings) {
for (const s of sub) { for (const s of sub) {
problem.old++; problem.old++;
if (s.verdict !== 'AC') { if (s.verdict !== 'AC') {
penalty += 20 * 60; penalty += 20;
} else { } else {
problem.time = Math.floor(s.time / 60); problem.time = Math.floor(s.time / 60);
penalty += s.time; penalty += Math.floor(s.time / 60);
break; break;
} }
} }
@@ -223,6 +226,7 @@ export function start(data: ResolverInput, options: DisplaySettings) {
} }
} }
} }
console.log(ops.length, 'operations');
return ops; return ops;
}, [data]); }, [data]);
@@ -266,6 +270,7 @@ export function start(data: ResolverInput, options: DisplaySettings) {
{data.problems.map((v) => { {data.problems.map((v) => {
const uncover = team.id === selectedTeam && selectedProblem === v.id; const uncover = team.id === selectedTeam && selectedProblem === v.id;
const problemStatus = team.problems.find((idx) => idx.id === v.id); const problemStatus = team.problems.find((idx) => idx.id === v.id);
if (!problemStatus) return <span key={v.id} className="item">ERR</span>;
return <span key={v.id} className={`${status(problemStatus)} ${uncover ? 'uncover' : ''} item`}> return <span key={v.id} className={`${status(problemStatus)} ${uncover ? 'uncover' : ''} item`}>
{submissions(problemStatus)} {submissions(problemStatus)}
</span>; </span>;
@@ -273,7 +278,7 @@ export function start(data: ResolverInput, options: DisplaySettings) {
</div> </div>
</div> </div>
<div className="solved">{team.score}</div> <div className="solved">{team.score}</div>
<div className="penalty">{Math.floor(team.penalty / 60)}</div> <div className="penalty">{team.penalty}</div>
</>} </>}
/>; />;
})} })}
+4 -4
View File
@@ -1,9 +1,9 @@
/* eslint-disable max-len */ /* eslint-disable max-len */
import moment from 'moment'; import moment from 'moment';
import { import {
AdmZip, avatar, ContestModel, ContestNotEndedError, Context, db, findFileSync, ForbiddenError, AdmZip, avatar, ContestModel, ContestNotEndedError, Context, db, findFileSync,
fs, ForbiddenError, fs, ObjectId, parseTimeMS, PERM, ProblemConfig, ProblemModel,
ObjectId, parseTimeMS, PERM, ProblemConfig, ProblemModel, STATUS, STATUS_SHORT_TEXTS, STATUS_TEXTS, Time, UserModel, STATUS, STATUS_SHORT_TEXTS, STATUS_TEXTS, Time, UserModel,
} from 'hydrooj'; } from 'hydrooj';
import { ResolverInput } from './interface'; import { ResolverInput } from './interface';
@@ -69,7 +69,7 @@ export function apply(ctx: Context) {
submissions: submissions.map((i) => ({ submissions: submissions.map((i) => ({
team: i.uid.toString(), team: i.uid.toString(),
problem: i.pid.toString(), problem: i.pid.toString(),
verdict: i.status === STATUS.STATUS_ACCEPTED ? 'AC' : 'RJ', verdict: STATUS_SHORT_TEXTS[i.status],
time: time(i.rid), time: time(i.rid),
})), })),
} as ResolverInput, } as ResolverInput,