MCPcopy Index your code
hub / github.com/hydro-dev/Hydro / ProblemSolutionRawHandler

Class ProblemSolutionRawHandler

packages/hydrooj/src/handler/problem.ts:943–963  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

941}
942
943export class ProblemSolutionRawHandler extends ProblemDetailHandler {
944 @param('psid', Types.ObjectId)
945 @route('psrid', Types.ObjectId, true)
946 @param('tid', Types.ObjectId, true)
947 async get(domainId: string, psid: ObjectId, psrid?: ObjectId, tid?: ObjectId) {
948 if (tid) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_SOLUTION);
949 const accepted = this.psdoc?.status === STATUS.STATUS_ACCEPTED;
950 if (!accepted || !this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION_ACCEPT)) {
951 this.checkPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION);
952 }
953 if (psrid) {
954 const [psdoc, psrdoc] = await solution.getReply(domainId, psid, psrid);
955 if ((!psdoc) || psdoc.parentId !== this.pdoc.docId) throw new SolutionNotFoundError(psid, psrid);
956 this.response.body = psrdoc.content;
957 } else {
958 const psdoc = await solution.get(domainId, psid);
959 this.response.body = psdoc.content;
960 }
961 this.response.type = 'text/markdown';
962 }
963}
964
965export class ProblemStatisticsHandler extends ProblemDetailHandler {
966 @param('sort', Types.Range(Object.keys(record.STAT_QUERY)), true)

Callers

nothing calls this directly

Calls 2

paramFunction · 0.85
routeFunction · 0.85

Tested by

no test coverage detected