Skip to content

Commit

Permalink
onsite-toolkit: skip CE
Browse files Browse the repository at this point in the history
  • Loading branch information
undefined-moe committed Nov 23, 2024
1 parent 45fe2d8 commit 979f68a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
19 changes: 12 additions & 7 deletions packages/onsite-toolkit/frontend/resolver.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ interface ProblemStatus {
frozen: number;
pass: boolean;
time: number;
index: number;
id?: string;
}

function status(problem: ProblemStatus) {
Expand Down Expand Up @@ -72,9 +74,10 @@ export function start(data: ResolverInput, options: DisplaySettings) {
pass: false,
id: problem.id,
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');
for (const submission of allSubmissions) {
const team = teams.find((v) => v.id === submission.team);
Expand Down Expand Up @@ -137,18 +140,18 @@ export function start(data: ResolverInput, options: DisplaySettings) {
},
async revealProblem(teamId: string, problemId: string) {
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 (allAc.find((s) => s.team === teamId && s.problem === problemId)) {
const sub = allSubmissions.filter((s) => s.team === teamId && s.problem === problemId);
let penalty = 0;
for (const s of sub) {
problem.old++;
if (s.verdict !== 'AC') {
penalty += 20 * 60;
penalty += 20;
} else {
problem.time = Math.floor(s.time / 60);
penalty += s.time;
penalty += Math.floor(s.time / 60);
break;
}
}
Expand Down Expand Up @@ -199,10 +202,10 @@ export function start(data: ResolverInput, options: DisplaySettings) {
for (const s of sub) {
problem.old++;
if (s.verdict !== 'AC') {
penalty += 20 * 60;
penalty += 20;
} else {
problem.time = Math.floor(s.time / 60);
penalty += s.time;
penalty += Math.floor(s.time / 60);
break;
}
}
Expand All @@ -223,6 +226,7 @@ export function start(data: ResolverInput, options: DisplaySettings) {
}
}
}
console.log(ops.length, 'operations');
return ops;
}, [data]);

Expand Down Expand Up @@ -266,14 +270,15 @@ export function start(data: ResolverInput, options: DisplaySettings) {
{data.problems.map((v) => {
const uncover = team.id === selectedTeam && selectedProblem === 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`}>
{submissions(problemStatus)}
</span>;
})}
</div>
</div>
<div className="solved">{team.score}</div>
<div className="penalty">{Math.floor(team.penalty / 60)}</div>
<div className="penalty">{team.penalty}</div>
</>}
/>;
})}
Expand Down
8 changes: 4 additions & 4 deletions packages/onsite-toolkit/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable max-len */
import moment from 'moment';
import {
AdmZip, avatar, ContestModel, ContestNotEndedError, Context, db, findFileSync, ForbiddenError,
fs,
ObjectId, parseTimeMS, PERM, ProblemConfig, ProblemModel, STATUS, STATUS_SHORT_TEXTS, STATUS_TEXTS, Time, UserModel,
AdmZip, avatar, ContestModel, ContestNotEndedError, Context, db, findFileSync,
ForbiddenError, fs, ObjectId, parseTimeMS, PERM, ProblemConfig, ProblemModel,
STATUS, STATUS_SHORT_TEXTS, STATUS_TEXTS, Time, UserModel,
} from 'hydrooj';
import { ResolverInput } from './interface';

Expand Down Expand Up @@ -69,7 +69,7 @@ export function apply(ctx: Context) {
submissions: submissions.map((i) => ({
team: i.uid.toString(),
problem: i.pid.toString(),
verdict: i.status === STATUS.STATUS_ACCEPTED ? 'AC' : 'RJ',
verdict: STATUS_SHORT_TEXTS[i.status],
time: time(i.rid),
})),
} as ResolverInput,
Expand Down

0 comments on commit 979f68a

Please sign in to comment.