MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / get

Method get

packages/hydrooj/src/handler/problem.ts:970–988  ·  view source on GitHub ↗
(domainId: string, sort = 'time', direction: 1 | -1 = 1, lang?: string, page = 1)

Source from the content-addressed store, hash-verified

968 @param('lang', Types.String, true)
969 @param('page', Types.PositiveInt, true)
970 async get(domainId: string, sort = 'time', direction: 1 | -1 = 1, lang?: string, page = 1) {
971 if (this.tdoc) throw new ContestNotEndedError();
972 const [rsdocs, pcount, rscount] = await this.paginate(
973 record.getMultiStat(domainId, {
974 pid: this.pdoc.docId,
975 ...lang ? { lang } : {},
976 }, record.STAT_QUERY[sort][Math.max(direction, 0)]),
977 page,
978 'record',
979 );
980 const [udict, udoc] = await Promise.all([
981 user.getListForRender(domainId, rsdocs.map((i) => i.uid), this.user.hasPerm(PERM.PERM_VIEW_USER_PRIVATE_INFO)),
982 user.getById(domainId, this.pdoc.owner),
983 ]);
984 this.response.template = 'problem_statistics.html';
985 this.response.body = {
986 rsdocs, page, pcount, rscount, sort, direction, pdoc: this.pdoc, udict, types: Object.keys(record.STAT_QUERY), udoc,
987 };
988 }
989}
990
991export class ProblemCreateHandler extends Handler {

Callers

nothing calls this directly

Calls 6

getMultiStatMethod · 0.80
getListForRenderMethod · 0.80
hasPermMethod · 0.80
getByIdMethod · 0.80
paginateMethod · 0.65
allMethod · 0.45

Tested by

no test coverage detected