(domainId: string, qs = '')
| 279 | export class ProblemRandomHandler extends Handler { |
| 280 | @param('q', Types.Content, true) |
| 281 | async get(domainId: string, qs = '') { |
| 282 | const category = flattenDeep(qs.split(' ') |
| 283 | .filter((i) => i.startsWith('category:')) |
| 284 | .map((i) => i.split('category:')[1]?.split(','))); |
| 285 | const q = buildQuery(this.user); |
| 286 | if (category.length) q.$and = category.map((tag) => ({ tag })); |
| 287 | await this.ctx.parallel('problem/list', q, this); |
| 288 | const pid = await problem.random(domainId, q); |
| 289 | if (!pid) throw new NoProblemError(); |
| 290 | this.response.body = { pid }; |
| 291 | this.response.redirect = this.url('problem_detail', { pid }); |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | export class ProblemDetailHandler extends ContestDetailBaseHandler { |
nothing calls this directly
no test coverage detected