This commit is contained in:
undefined committed 2020-07-30 23:09:03 +08:00
1 parent 51dc2e972d
commit 43ee86d34b
17 files changed
+177 -88

No files matched your search

+1 -1
View File
@@ -13,7 +13,7 @@ class DomainRankHandler extends Handler {
@param('page', Types.UnsignedInt, true)
async get(domainId: string, page = 1) {
const [dudocs, upcount, ucount] = await paginate(
domain.getMultiInDomain(domainId).sort({ rating: -1 }),
domain.getMultiInDomain(domainId).sort({ rp: -1 }),
page,
100,
);
+1 -1
View File
@@ -95,7 +95,7 @@ class SystemScriptHandler extends SystemHandler {
validate(global.Hydro.script[id].validate, args);
const rid = await record.add(domainId, -1, this.user._id, '-', id, false, { input: 'raw' });
const report = (data) => judge.next({ domainId, rid, ...data });
report({ message: `Running script: ${id}` });
report({ message: `Running script: ${id}`, status: STATUS.STATUS_JUDGING });
const start = new Date().getTime();
// Maybe async?
global.Hydro.script[id].run(args, report)
+3 -2
View File
@@ -1,5 +1,5 @@
import { ObjectID } from 'mongodb';
import { PermissionError } from '../error';
import { PermissionError, RecordNotFoundError } from '../error';
import { PERM } from '../model/builtin';
import * as problem from '../model/problem';
import * as record from '../model/record';
@@ -63,6 +63,7 @@ class RecordDetailHandler extends RecordHandler {
async get(domainId: string, rid: ObjectID) {
this.response.template = 'record_detail.html';
const rdoc = await record.get(domainId, rid);
if (!rdoc) throw new RecordNotFoundError(rid);
if (rdoc.contest) {
const tdoc = await contest.get(domainId, rdoc.contest.tid, rdoc.contest.type);
if (!this.canShowRecord(tdoc, true)) throw new PermissionError(rid);
@@ -71,7 +72,7 @@ class RecordDetailHandler extends RecordHandler {
rdoc.code = null;
}
const [pdoc, udoc] = await Promise.all([
problem.get(domainId, rdoc.pid, null),
problem.get(domainId, rdoc.pid),
user.getById(domainId, rdoc.uid),
]);
this.response.body = {