utils: add STATUS_SHORT_TEXTS

This commit is contained in:
undefined committed 2021-05-17 01:01:26 +08:00
1 parent 218a14b91e
commit 625478ac3a
5 files changed
+18 -3

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "2.26.4", "version": "2.26.5",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "dist/loader.js", "main": "dist/loader.js",
"typings": "dist/loader.d.ts", "typings": "dist/loader.d.ts",
+1
View File
@@ -38,6 +38,7 @@ async function _postJudge(rdoc: RecordDoc) {
await Promise.all([ await Promise.all([
record.update(rdoc.domainId, rdoc._id, { effective: true }), record.update(rdoc.domainId, rdoc._id, { effective: true }),
problem.edit(pdoc.domainId, pdoc.docId, { difficulty }), problem.edit(pdoc.domainId, pdoc.docId, { difficulty }),
problem.inc(pdoc.domainId, pdoc.docId, `stats.${builtin.STATUS_SHORT_TEXTS[rdoc.status]}`, 1),
]); ]);
await bus.serial('record/judge', rdoc, updated); await bus.serial('record/judge', rdoc, updated);
} }
+1 -1
View File
@@ -114,7 +114,7 @@ export class ProblemModel {
return document.deleteSub(domainId, document.TYPE_PROBLEM, pid, key, values); return document.deleteSub(domainId, document.TYPE_PROBLEM, pid, key, values);
} }
static inc(domainId: string, _id: number, field: NumberKeys<ProblemDoc>, n: number): Promise<ProblemDoc> { static inc(domainId: string, _id: number, field: NumberKeys<ProblemDoc> | string, n: number): Promise<ProblemDoc> {
return document.inc(domainId, document.TYPE_PROBLEM, _id, field, n); return document.inc(domainId, document.TYPE_PROBLEM, _id, field, n);
} }
+14
View File
@@ -36,6 +36,20 @@ export const STATUS_TEXTS = {
[STATUS.STATUS_IGNORED]: 'Ignored', [STATUS.STATUS_IGNORED]: 'Ignored',
}; };
export const STATUS_SHORT_TEXTS = {
[STATUS.STATUS_ACCEPTED]: 'AC',
[STATUS.STATUS_WRONG_ANSWER]: 'WA',
[STATUS.STATUS_TIME_LIMIT_EXCEEDED]: 'TLE',
[STATUS.STATUS_MEMORY_LIMIT_EXCEEDED]: 'MLE',
[STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED]: 'OLE',
[STATUS.STATUS_RUNTIME_ERROR]: 'RE',
[STATUS.STATUS_COMPILE_ERROR]: 'CE',
[STATUS.STATUS_SYSTEM_ERROR]: 'SE',
[STATUS.STATUS_CANCELED]: 'IGN',
[STATUS.STATUS_HACKED]: 'HK',
[STATUS.STATUS_IGNORED]: 'IGN',
};
export const STATUS_CODES = { export const STATUS_CODES = {
0: 'pending', 0: 'pending',
1: 'pass', 1: 'pass',
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/utils", "name": "@hydrooj/utils",
"version": "1.0.15", "version": "1.0.16",
"description": "hydrooj utils", "description": "hydrooj utils",
"main": "package.json", "main": "package.json",
"repository": "https://github.com/hydro-dev/Hydro.git", "repository": "https://github.com/hydro-dev/Hydro.git",