mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: bug fixes
This commit is contained in:
1 parent
5baf8f3207
commit
7f7d674dc4
6 files changed
+10
-10
No files matched your search
@@ -6,7 +6,7 @@ export function parse(output: string, fullscore: number) {
|
||||
let status = STATUS.STATUS_WRONG_ANSWER;
|
||||
let score = 0;
|
||||
let builder = (msg: string) => msg;
|
||||
let message = output.substring(0, 1024);
|
||||
let message = `${output.substring(0, 1024)} `;
|
||||
if (output.startsWith('ok ')) {
|
||||
status = STATUS.STATUS_ACCEPTED;
|
||||
score = fullscore;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "4.2.14",
|
||||
"version": "4.2.15",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/plugin-api",
|
||||
"module": "src/plugin-api",
|
||||
|
||||
@@ -22,7 +22,8 @@ const validatePenaltyRules = (input: string) => yaml.load(input);
|
||||
const convertPenaltyRules = validatePenaltyRules;
|
||||
|
||||
class HomeworkMainHandler extends Handler {
|
||||
async get({ domainId, page = 1 }) {
|
||||
@param('page', Types.PositiveInt, true)
|
||||
async get(domainId: string, page = 1) {
|
||||
const cursor = contest.getMulti(domainId, { rule: 'homework' });
|
||||
const [tdocs, tpcount] = await paginate<Tdoc>(cursor, page, system.get('pagination.contest'));
|
||||
const calendar = [];
|
||||
|
||||
@@ -181,13 +181,12 @@ const acm = buildContestRule({
|
||||
docType: document.TYPE_CONTEST,
|
||||
docId: tdoc.docId,
|
||||
accept: { $gte: 1 },
|
||||
detail: { $elemMatch: { status: STATUS.STATUS_ACCEPTED } },
|
||||
},
|
||||
},
|
||||
{ $unwind: '$detail' },
|
||||
{ $match: { 'detail.status': STATUS.STATUS_ACCEPTED } },
|
||||
{ $sort: { 'detail.rid': 1 } },
|
||||
{ $group: { _id: '$detail.pid', first: { $first: '$detail.rid' } } },
|
||||
{ $project: { r: { $objectToArray: '$detail' } } },
|
||||
{ $unwind: '$r' },
|
||||
{ $match: { 'r.v.status': STATUS.STATUS_ACCEPTED } },
|
||||
{ $group: { _id: '$r.v.pid', first: { $min: '$r.v.rid' } } },
|
||||
]).toArray() as any[];
|
||||
for (const t of data) first[t._id] = t.first.generationTime;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ export function ansiToHtml(str: string, whiteToBlack = true) {
|
||||
|
||||
export function datetimeSpan(dt: Date | ObjectID, relative = true, format = 'YYYY-M-D H:mm:ss', tz = 'Asia/Shanghai') {
|
||||
if (!dt) return 'DATETIME_SPAN_ERROR';
|
||||
if (dt instanceof ObjectID) dt = new Date(dt.generationTime * 1000);
|
||||
if (dt instanceof ObjectID) dt = dt.getTimestamp();
|
||||
else if (typeof dt === 'string' && ObjectID.isValid(dt)) dt = new Date(new ObjectID(dt).generationTime * 1000);
|
||||
else if (typeof dt === 'number' || typeof dt === 'string') dt = new Date(dt);
|
||||
return '<span class="time{0}" data-timestamp="{1}">{2}</span>'.format(
|
||||
|
||||
@@ -99,7 +99,7 @@ setDiagnosticsOptions({
|
||||
schema: problemConfigSchema as any,
|
||||
},
|
||||
{
|
||||
uri: '/manage/config/schema.json',
|
||||
uri: new URL('/manage/config/schema.json', window.location.href).toString(),
|
||||
fileMatch: ['hydro://system/setting.yaml'],
|
||||
},
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user