core: bug fixes

This commit is contained in:
undefined committed 2022-10-29 14:30:42 +08:00
1 parent 5baf8f3207
commit 7f7d674dc4
6 files changed
+10 -10

No files matched your search

+1 -1
View File
@@ -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",
+2 -1
View File
@@ -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 = [];
+4 -5
View File
@@ -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;