core: record_list: add projection for problem

This commit is contained in:
undefined committed 2023-02-07 14:39:11 +08:00
1 parent 018257f2b8
commit b84a6426dd
1 file changed
+5 -3
+5 -3
View File
@@ -1,4 +1,6 @@
import { omit, pick, throttle } from 'lodash';
import {
omit, pick, throttle, uniqBy,
} from 'lodash';
import { FilterQuery, ObjectID } from 'mongodb';
import {
ContestNotAttendedError, ContestNotFoundError, HackRejudgeFailedError,
@@ -91,8 +93,8 @@ class RecordListHandler extends ContestDetailBaseHandler {
: await Promise.all([
user.getList(domainId, rdocs.map((rdoc) => rdoc.uid)),
canViewProblem
? problem.getList(domainId, rdocs.map((rdoc) => rdoc.pid), canViewHiddenProblem, false)
: Object.fromEntries([rdocs.map((rdoc) => [rdoc.pid, { ...problem.default, pid: rdoc.pid }])]),
? problem.getList(domainId, rdocs.map((rdoc) => rdoc.pid), canViewHiddenProblem, false, problem.PROJECTION_LIST)
: Object.fromEntries(uniqBy(rdocs, 'pid').map((rdoc) => [rdoc.pid, { ...problem.default, pid: rdoc.pid }])),
]);
this.response.body = {
page,