mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +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 status = STATUS.STATUS_WRONG_ANSWER;
|
||||||
let score = 0;
|
let score = 0;
|
||||||
let builder = (msg: string) => msg;
|
let builder = (msg: string) => msg;
|
||||||
let message = output.substring(0, 1024);
|
let message = `${output.substring(0, 1024)} `;
|
||||||
if (output.startsWith('ok ')) {
|
if (output.startsWith('ok ')) {
|
||||||
status = STATUS.STATUS_ACCEPTED;
|
status = STATUS.STATUS_ACCEPTED;
|
||||||
score = fullscore;
|
score = fullscore;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "4.2.14",
|
"version": "4.2.15",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/plugin-api",
|
"main": "src/plugin-api",
|
||||||
"module": "src/plugin-api",
|
"module": "src/plugin-api",
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ const validatePenaltyRules = (input: string) => yaml.load(input);
|
|||||||
const convertPenaltyRules = validatePenaltyRules;
|
const convertPenaltyRules = validatePenaltyRules;
|
||||||
|
|
||||||
class HomeworkMainHandler extends Handler {
|
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 cursor = contest.getMulti(domainId, { rule: 'homework' });
|
||||||
const [tdocs, tpcount] = await paginate<Tdoc>(cursor, page, system.get('pagination.contest'));
|
const [tdocs, tpcount] = await paginate<Tdoc>(cursor, page, system.get('pagination.contest'));
|
||||||
const calendar = [];
|
const calendar = [];
|
||||||
|
|||||||
@@ -181,13 +181,12 @@ const acm = buildContestRule({
|
|||||||
docType: document.TYPE_CONTEST,
|
docType: document.TYPE_CONTEST,
|
||||||
docId: tdoc.docId,
|
docId: tdoc.docId,
|
||||||
accept: { $gte: 1 },
|
accept: { $gte: 1 },
|
||||||
detail: { $elemMatch: { status: STATUS.STATUS_ACCEPTED } },
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ $unwind: '$detail' },
|
{ $project: { r: { $objectToArray: '$detail' } } },
|
||||||
{ $match: { 'detail.status': STATUS.STATUS_ACCEPTED } },
|
{ $unwind: '$r' },
|
||||||
{ $sort: { 'detail.rid': 1 } },
|
{ $match: { 'r.v.status': STATUS.STATUS_ACCEPTED } },
|
||||||
{ $group: { _id: '$detail.pid', first: { $first: '$detail.rid' } } },
|
{ $group: { _id: '$r.v.pid', first: { $min: '$r.v.rid' } } },
|
||||||
]).toArray() as any[];
|
]).toArray() as any[];
|
||||||
for (const t of data) first[t._id] = t.first.generationTime;
|
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') {
|
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) 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 === 'string' && ObjectID.isValid(dt)) dt = new Date(new ObjectID(dt).generationTime * 1000);
|
||||||
else if (typeof dt === 'number' || typeof dt === 'string') dt = new Date(dt);
|
else if (typeof dt === 'number' || typeof dt === 'string') dt = new Date(dt);
|
||||||
return '<span class="time{0}" data-timestamp="{1}">{2}</span>'.format(
|
return '<span class="time{0}" data-timestamp="{1}">{2}</span>'.format(
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ setDiagnosticsOptions({
|
|||||||
schema: problemConfigSchema as any,
|
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'],
|
fileMatch: ['hydro://system/setting.yaml'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in new issue
Block a user