From 52b5fef5b445fe744907ba8d6f1d32ca03103d74 Mon Sep 17 00:00:00 2001 From: Pisces000221 <1786762946@qq.com> Date: Fri, 19 Jan 2018 10:36:50 +0800 Subject: [PATCH] Add reset code length subroutine --- modules/admin.js | 6 ++++++ views/admin_other.ejs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/admin.js b/modules/admin.js index 72673b9..25c87a2 100644 --- a/modules/admin.js +++ b/modules/admin.js @@ -325,6 +325,12 @@ app.post('/admin/other', async (req, res) => { for (const a of articles) { await a.resetReplyCountAndTime(); } + } 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(); + } } else { throw new ErrorMessage("操作类型不正确"); } diff --git a/views/admin_other.ejs b/views/admin_other.ejs index d0b1ef6..e422dd0 100644 --- a/views/admin_other.ejs +++ b/views/admin_other.ejs @@ -3,6 +3,6 @@

- +

<% include admin_footer %>