mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-18 09:36:08 +08:00
core: problem.get with raw config
This commit is contained in:
1 parent
973f19db68
commit
f768e96867
2 files changed
+3
-2
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.1.32",
|
||||
"version": "3.1.33",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -107,6 +107,7 @@ export class ProblemModel {
|
||||
static async get(
|
||||
domainId: string, pid: string | number,
|
||||
projection: Projection<ProblemDoc> = ProblemModel.PROJECTION_PUBLIC,
|
||||
rawConfig = false,
|
||||
): Promise<ProblemDoc | null> {
|
||||
if (typeof pid !== 'number') {
|
||||
if (Number.isSafeInteger(parseInt(pid, 10))) pid = parseInt(pid, 10);
|
||||
@@ -116,7 +117,7 @@ export class ProblemModel {
|
||||
: (await document.getMulti(domainId, document.TYPE_PROBLEM, { pid }).toArray())[0];
|
||||
if (!res) return null;
|
||||
try {
|
||||
res.config = await parseConfig(res.config);
|
||||
if (!rawConfig) res.config = await parseConfig(res.config);
|
||||
} catch (e) {
|
||||
res.config = `Cannot parse: ${e.message}`;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user