(domainId: string, query: Filter<ProblemDoc>)
| 374 | } |
| 375 | |
| 376 | static async random(domainId: string, query: Filter<ProblemDoc>) { |
| 377 | const pcount = await document.count(domainId, document.TYPE_PROBLEM, query); |
| 378 | if (!pcount) return null; |
| 379 | const pdoc = await document.getMulti(domainId, document.TYPE_PROBLEM, query) |
| 380 | .skip(Math.floor(Math.random() * pcount)).limit(1).toArray(); |
| 381 | return pdoc[0].pid || pdoc[0].docId; |
| 382 | } |
| 383 | |
| 384 | static async getList( |
| 385 | domainId: string, pids: number[], canViewHidden: number | boolean = false, |
no test coverage detected