From 0ac203806cb21e9b6375e35261462df22a500a5f Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Tue, 19 May 2026 04:25:31 -0600 Subject: [PATCH] fix: round up initial rows to nearest multiple of 5 --- src/admin/problem/components/TestcaseGenerator.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/admin/problem/components/TestcaseGenerator.vue b/src/admin/problem/components/TestcaseGenerator.vue index 544a8b6..4183b72 100644 --- a/src/admin/problem/components/TestcaseGenerator.vue +++ b/src/admin/problem/components/TestcaseGenerator.vue @@ -27,7 +27,8 @@ let nextId = 0 function makeInitialFiles(): FileEntry[] { const fromSamples = (props.samples ?? []).map((s) => ({ id: nextId++, in: s.input, out: s.output, error: false })) - const extra = Math.max(0, 5 - fromSamples.length) + const total = Math.ceil(Math.max(fromSamples.length, 1) / 5) * 5 + const extra = total - fromSamples.length return [...fromSamples, ...Array.from({ length: extra }, () => ({ id: nextId++, in: "", out: "", error: false }))] }