feat(remote_judger): submitProblem status report

This commit is contained in:
Baoshuo Ren 2023-04-08 15:45:35 +08:00
parent 10ee5ca049
commit 36ff691a04
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
6 changed files with 24 additions and 4 deletions

View File

@ -205,6 +205,8 @@ export default class AtcoderProvider implements IBasicProvider {
`(S2OJ Submission #${submissionId})`
);
await next({ status: 'Submitting to AtCoder...' });
// TODO: check submit time to ensure submission
const res = await this.post(`/contests/${contestId}/submit`).send({
csrf_token: csrf,
@ -227,6 +229,8 @@ export default class AtcoderProvider implements IBasicProvider {
this.cookie = res.header['set-cookie'];
}
await next({ status: 'Submitted to AtCoder' });
const { text: status, header: status_header } = await this.get(
`/contests/${contestId}/submissions/me`
).retry(3);
@ -280,7 +284,7 @@ export default class AtcoderProvider implements IBasicProvider {
statusElem.title === 'Waiting for Re-judging' ||
['WJ', 'WR'].includes(statusElem.innerHTML.trim())
) {
await next({ test_id: 0 });
await next({ status: '[AtCoder] Waiting for Judging' });
continue;
}

View File

@ -277,6 +277,8 @@ export default class CodeforcesProvider implements IBasicProvider {
`(S2OJ Submission #${submissionId})`
);
await next({ status: 'Submitting to Codeforces...' });
// TODO: check submit time to ensure submission
const { text: submit, error } = await this.post(
`/${
@ -328,6 +330,8 @@ export default class CodeforcesProvider implements IBasicProvider {
return null;
}
await next({ status: 'Submitted to Codeforces' });
const { text: status } = await this.get(
type !== 'GYM' ? '/problemset/status?my=on' : `/gym/${contestId}/my`
).retry(3);
@ -350,9 +354,9 @@ export default class CodeforcesProvider implements IBasicProvider {
let count = 0;
let fail = 0;
while (count < 180 && fail < 10) {
while (count < 360 && fail < 60) {
count++;
await sleep(1000);
await sleep(500);
try {
const { body } = await this.post('/data/submitSource')

View File

@ -249,6 +249,8 @@ export default class LibreojProvider implements IBasicProvider {
`(S2OJ Submission #${submissionId})`
);
await next({ status: 'Submitting to LibreOJ...' });
const { body, error } = await this.post('/submission/submit').send({
problemId: id,
content: {
@ -268,6 +270,8 @@ export default class LibreojProvider implements IBasicProvider {
return null;
}
await next({ status: 'Submitted to LibreOJ' });
return body.submissionId;
}
@ -345,7 +349,7 @@ export default class LibreojProvider implements IBasicProvider {
}
await next({
status: `${body.progress.progressType}`,
status: `[LibreOJ] ${body.progress.progressType}`,
});
if (body.progress.progressType !== 'Finished') {

View File

@ -319,6 +319,8 @@ export default class LuoguProvider implements IBasicProvider {
code = `${comment[0]} ${msg} ${comment[1]}\n${code}`;
}
await next({ status: 'Submitting to Luogu...' });
if (this.account.type == 'luogu-api') {
const result = await this.post('/judge/problem').send({
pid: id,

View File

@ -200,6 +200,8 @@ export default class QOJProvider extends UOJProvider implements IBasicProvider {
code = `${comment[0]} ${msg} ${comment[1]}\n${code}`;
}
await next({ status: 'Submitting to QOJ...' });
const _token = await this.getCsrfToken(`/problem/${id}`);
const { text } = await this.post(`/problem/${id}`).send({
_token,

View File

@ -217,6 +217,8 @@ export default class UOJProvider implements IBasicProvider {
code = `${comment[0]} ${msg} ${comment[1]}\n${code}`;
}
await next({ status: 'Submitting to UniversalOJ...' });
const _token = await this.getCsrfToken(`/problem/${id}`);
const { text } = await this.post(`/problem/${id}`).send({
_token,
@ -228,6 +230,8 @@ export default class UOJProvider implements IBasicProvider {
if (!text.includes('我的提交记录')) throw new Error('Submit failed');
await next({ status: 'Submitted to UniversalOJ' });
const { text: status } = await this.get(
`/submissions?problem_id=${id}&submitter=${this.account.handle}`
);