core&ui&judge: bug fixes and improvements

pull/689/head
undefined 11 months ago
parent 16992e057d
commit efde5b339f
No known key found for this signature in database

@ -29,8 +29,7 @@ export function parse(output: string, fullscore: number) {
if (p === 1) { if (p === 1) {
status = STATUS.STATUS_ACCEPTED; status = STATUS.STATUS_ACCEPTED;
score = fullscore; score = fullscore;
const base = output.replace('points ', '') || ''; message = output.replace(/^points [\d.]+ /, '') || '';
message = base.substring(base.indexOf(' '), 1024);
} else score = Math.floor(fullscore * p); } else score = Math.floor(fullscore * p);
} }
while (operation.test(message)) { while (operation.test(message)) {

@ -245,6 +245,7 @@ export class ContestDetailHandler extends Handler {
@param('tid', Types.ObjectId) @param('tid', Types.ObjectId)
@param('code', Types.String, true) @param('code', Types.String, true)
async postAttend(domainId: string, tid: ObjectId, code = '') { async postAttend(domainId: string, tid: ObjectId, code = '') {
this.checkPerm(PERM.PERM_ATTEND_CONTEST);
if (contest.isDone(this.tdoc)) throw new ContestNotLiveError(tid); if (contest.isDone(this.tdoc)) throw new ContestNotLiveError(tid);
if (this.tdoc._code && code !== this.tdoc._code) throw new InvalidTokenError('Contest Invitation', code); if (this.tdoc._code && code !== this.tdoc._code) throw new InvalidTokenError('Contest Invitation', code);
await contest.attend(domainId, tid, this.user._id); await contest.attend(domainId, tid, this.user._id);

@ -10,6 +10,7 @@ export { default as Socket } from './components/socket/index';
export { default as uploadFiles } from './components/upload'; export { default as uploadFiles } from './components/upload';
export * as redux from 'react-redux'; export * as redux from 'react-redux';
export * from './components/zipDownloader'; export * from './components/zipDownloader';
export * from '@hydrooj/utils/lib/common';
export { default as download } from './components/zipDownloader'; export { default as download } from './components/zipDownloader';
export { default as $ } from 'jquery'; export { default as $ } from 'jquery';
export { default as _ } from 'lodash'; export { default as _ } from 'lodash';

@ -137,6 +137,7 @@ env.addGlobal('eval', eval);
env.addGlobal('Date', Date); env.addGlobal('Date', Date);
env.addGlobal('Object', Object); env.addGlobal('Object', Object);
env.addGlobal('String', String); env.addGlobal('String', String);
env.addGlobal('Array', Array);
env.addGlobal('Math', Math); env.addGlobal('Math', Math);
env.addGlobal('process', process); env.addGlobal('process', process);
env.addGlobal('global', global); env.addGlobal('global', global);

Loading…
Cancel
Save