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",
"version": "2.26.4",
"version": "2.26.5",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",
+1
View File
@@ -38,6 +38,7 @@ async function _postJudge(rdoc: RecordDoc) {
await Promise.all([
record.update(rdoc.domainId, rdoc._id, { effective: true }),
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);
}
+1 -1
View File
@@ -114,7 +114,7 @@ export class ProblemModel {
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);
}