mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: record_list: add projection for problem
This commit is contained in:
1 parent
018257f2b8
commit
b84a6426dd
1 file changed
+5
-3
@@ -1,4 +1,6 @@
|
|||||||
import { omit, pick, throttle } from 'lodash';
|
import {
|
||||||
|
omit, pick, throttle, uniqBy,
|
||||||
|
} from 'lodash';
|
||||||
import { FilterQuery, ObjectID } from 'mongodb';
|
import { FilterQuery, ObjectID } from 'mongodb';
|
||||||
import {
|
import {
|
||||||
ContestNotAttendedError, ContestNotFoundError, HackRejudgeFailedError,
|
ContestNotAttendedError, ContestNotFoundError, HackRejudgeFailedError,
|
||||||
@@ -91,8 +93,8 @@ class RecordListHandler extends ContestDetailBaseHandler {
|
|||||||
: await Promise.all([
|
: await Promise.all([
|
||||||
user.getList(domainId, rdocs.map((rdoc) => rdoc.uid)),
|
user.getList(domainId, rdocs.map((rdoc) => rdoc.uid)),
|
||||||
canViewProblem
|
canViewProblem
|
||||||
? problem.getList(domainId, rdocs.map((rdoc) => rdoc.pid), canViewHiddenProblem, false)
|
? problem.getList(domainId, rdocs.map((rdoc) => rdoc.pid), canViewHiddenProblem, false, problem.PROJECTION_LIST)
|
||||||
: Object.fromEntries([rdocs.map((rdoc) => [rdoc.pid, { ...problem.default, pid: rdoc.pid }])]),
|
: Object.fromEntries(uniqBy(rdocs, 'pid').map((rdoc) => [rdoc.pid, { ...problem.default, pid: rdoc.pid }])),
|
||||||
]);
|
]);
|
||||||
this.response.body = {
|
this.response.body = {
|
||||||
page,
|
page,
|
||||||
|
|||||||
Reference in new issue
Block a user