From c061bc3b5bdd825e964d0baf8948635d3b4b9f31 Mon Sep 17 00:00:00 2001 From: undefined Date: Fri, 4 Apr 2025 03:37:13 +0800 Subject: [PATCH] core: problem_list: fix status display --- packages/hydrooj/src/handler/problem.ts | 12 ++++-------- packages/hydrooj/src/model/oplog.ts | 1 + .../ui-default/templates/partials/problem_list.html | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index f27800b03..0d9ec9244 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -156,14 +156,10 @@ export class ProblemMainHandler extends Handler { if (sort.length) pdocs = pdocs.sort((a, b) => sort.indexOf(`${a.domainId}/${a.docId}`) - sort.indexOf(`${b.domainId}/${b.docId}`)); if (text && pcount > pdocs.length) pcount = pdocs.length; if (this.user.hasPriv(PRIV.PRIV_USER_PROFILE)) { - const domainIds = Array.from(new Set(pdocs.map((i) => i.domainId))); - await Promise.all( - domainIds.map((did) => - problem.getListStatus( - did, this.user._id, - pdocs.filter((i) => i.domainId === did).map((i) => i.docId), - ).then((res) => Object.assign(psdict, res))), - ); + Object.assign(psdict, await problem.getListStatus( + domainId, this.user._id, + pdocs.map((i) => i.docId), + )); } if (pjax) { this.response.body = { diff --git a/packages/hydrooj/src/model/oplog.ts b/packages/hydrooj/src/model/oplog.ts index 7dd10aaa5..14320f4fe 100644 --- a/packages/hydrooj/src/model/oplog.ts +++ b/packages/hydrooj/src/model/oplog.ts @@ -52,6 +52,7 @@ export async function log(handler: T, type: string, data: any args, operator: handler.user?._id, operateIp: handler.request.ip, + json: handler.request.json, }); return res.insertedId; } diff --git a/packages/ui-default/templates/partials/problem_list.html b/packages/ui-default/templates/partials/problem_list.html index fb305774e..259cc4df9 100644 --- a/packages/ui-default/templates/partials/problem_list.html +++ b/packages/ui-default/templates/partials/problem_list.html @@ -39,7 +39,7 @@ {%- for pdoc in pdocs -%} - {% set psdoc = psdict[pdoc.domainId + '#' + pdoc.docId] %} + {% set psdoc = psdict[pdoc.docId] %}