From bfad5f5fc0822d1b681e8d598d3012c2e3588e15 Mon Sep 17 00:00:00 2001 From: Pisces000221 <1786762946@qq.com> Date: Fri, 19 Jan 2018 10:40:41 +0800 Subject: [PATCH] Fix output only code length miscalculated --- modules/admin.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/admin.js b/modules/admin.js index 25c87a2..54bfaa1 100644 --- a/modules/admin.js +++ b/modules/admin.js @@ -328,8 +328,10 @@ app.post('/admin/other', async (req, res) => { } else if (req.body.type === 'reset_codelen') { const submissions = await JudgeState.query(); for (const s of submissions) { - s.code_length = s.code.length; - await s.save(); + if (s.type !== 'submit-answer') { + s.code_length = s.code.length; + await s.save(); + } } } else { throw new ErrorMessage("操作类型不正确");