mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
fix config parse fallback
This commit is contained in:
1 file changed
+1
-1
@@ -6,7 +6,7 @@ import type { ProblemConfig } from '../interface';
|
|||||||
|
|
||||||
export async function parseConfig(config: string | ProblemConfigFile = {}, files: string[]) {
|
export async function parseConfig(config: string | ProblemConfigFile = {}, files: string[]) {
|
||||||
const cfg: ProblemConfigFile = typeof config === 'string'
|
const cfg: ProblemConfigFile = typeof config === 'string'
|
||||||
? await readYamlCases(load(config) as Record<string, any>)
|
? await readYamlCases(load(config || '{}') as Record<string, any>)
|
||||||
: await readYamlCases(config);
|
: await readYamlCases(config);
|
||||||
const result: ProblemConfig = {
|
const result: ProblemConfig = {
|
||||||
count: Object.keys(cfg.answers || {}).length || Math.sum((cfg.subtasks || []).map((s) => s.cases.length)),
|
count: Object.keys(cfg.answers || {}).length || Math.sum((cfg.subtasks || []).map((s) => s.cases.length)),
|
||||||
|
|||||||
Reference in new issue
Block a user