mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
bug fixes
This commit is contained in:
6 files changed
+19
-25
No files matched your search
@@ -234,7 +234,7 @@ export default class RecordModel {
|
||||
}
|
||||
|
||||
static async reset(domainId: string, rid: MaybeArray<ObjectId>, isRejudge: boolean) {
|
||||
const rids = rid instanceof Array ? rid : [rid];
|
||||
const rids = Array.isArray(rid) ? rid : [rid];
|
||||
const upd: any = {
|
||||
score: 0,
|
||||
status: STATUS.STATUS_WAITING,
|
||||
@@ -281,7 +281,7 @@ export default class RecordModel {
|
||||
}
|
||||
}
|
||||
|
||||
export function apply(ctx: Context) {
|
||||
export async function apply(ctx: Context) {
|
||||
// Mark problem as deleted
|
||||
ctx.on('problem/delete', (domainId, docId) => Promise.all([
|
||||
RecordModel.coll.deleteMany({ domainId, pid: docId }),
|
||||
@@ -305,7 +305,7 @@ export function apply(ctx: Context) {
|
||||
}, { upsert: true });
|
||||
}
|
||||
});
|
||||
ctx.on('ready', () => Promise.all([
|
||||
await Promise.all([
|
||||
db.ensureIndexes(
|
||||
RecordModel.coll,
|
||||
{ key: { domainId: 1, pid: 1 }, name: 'delete' },
|
||||
@@ -322,6 +322,10 @@ export function apply(ctx: Context) {
|
||||
{ key: { domainId: 1, pid: 1, uid: 1, memory: 1 }, name: 'memory' },
|
||||
{ key: { domainId: 1, pid: 1, uid: 1, length: 1 }, name: 'length' },
|
||||
),
|
||||
]) as any);
|
||||
db.ensureIndexes(
|
||||
RecordModel.collHistory,
|
||||
{ key: { rid: 1, _id: -1 }, name: 'basic' },
|
||||
),
|
||||
]);
|
||||
}
|
||||
global.Hydro.model.record = RecordModel;
|
||||
@@ -7,13 +7,13 @@ import { Context, Service } from '../context';
|
||||
import { PERM, PRIV } from '../model/builtin';
|
||||
import { Handler } from './server';
|
||||
|
||||
const types: Record<string, Record<string, string>> = {};
|
||||
const unions: Record<string, string> = {};
|
||||
const descriptions: Record<string, Record<string, string>> = {};
|
||||
const types: Record<string, Record<string, string>> = Object.create(null);
|
||||
const unions: Record<string, string> = Object.create(null);
|
||||
const descriptions: Record<string, Record<string, string>> = Object.create(null);
|
||||
const handlers: Record<string, Record<string, any>> = {
|
||||
Query: {},
|
||||
Query: Object.create(null),
|
||||
};
|
||||
let root: Record<string, any> = {};
|
||||
let root: Record<string, any> = Object.create(null);
|
||||
|
||||
interface ApiContext extends ApiHandler {
|
||||
[key: string]: any;
|
||||
|
||||
@@ -1,22 +1,11 @@
|
||||
import path from 'path';
|
||||
import {
|
||||
ContestModel, Context, fs, Handler, ObjectId, PERM, Schema, STATUS, Types, UserModel,
|
||||
ContestModel, Context, fs, ObjectId, PERM, Schema, STATUS, Types, UserModel,
|
||||
} from 'hydrooj';
|
||||
|
||||
const file = fs.readFileSync(path.join(__dirname, 'public/assets/board.html'), 'utf8');
|
||||
const indexJs = file.match(/index-([A-Za-z0-9_-]+)\.js"/)?.[1];
|
||||
const indexCss = file.match(/index-([A-Za-z0-9_-]+)\.css"/)?.[1];
|
||||
|
||||
class XcpcioHandler extends Handler {
|
||||
async get() {
|
||||
this.response.body = {
|
||||
js: indexJs,
|
||||
css: indexCss,
|
||||
};
|
||||
this.response.template = 'xcpcio_board.html';
|
||||
}
|
||||
}
|
||||
|
||||
const status = {
|
||||
[STATUS.STATUS_WRONG_ANSWER]: 'WRONG_ANSWER',
|
||||
[STATUS.STATUS_ACCEPTED]: 'CORRECT',
|
||||
@@ -35,7 +24,6 @@ const status = {
|
||||
};
|
||||
|
||||
export async function apply(ctx: Context) {
|
||||
ctx.Route('board_xcpcio', '/board', XcpcioHandler);
|
||||
ctx.inject(['scoreboard'], ({ scoreboard }) => {
|
||||
scoreboard.addView('xcpcio', 'XCPCIO', {
|
||||
tdoc: 'tdoc',
|
||||
|
||||
@@ -185,7 +185,7 @@ class VJudgeService extends Service {
|
||||
super(ctx, 'vjudge');
|
||||
}
|
||||
|
||||
accounts: RemoteAccount[];
|
||||
accounts: RemoteAccount[] = [];
|
||||
private providers: Record<string, any> = {};
|
||||
private pool: Record<string, AccountService> = {};
|
||||
async [Service.setup]() {
|
||||
|
||||
Reference in new issue
Block a user