diff --git a/README.md b/README.md index eafb630..6ae8f51 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,9 @@ git clone https://github.com/syzoj/syzoj cd syzoj ``` -Install dependencies with `npm install` or `yarn`. +Install dependencies with `npm install` or `yarn`. Also, follow the instructions [here](https://www.npmjs.com/package/node-7z#installation) to install `7z` executable used by the `node-7z` package. -Copy the `config-example.json` file to `config.json`, and change the configures. +Copy `config-example.json` to `config.json`, and make necessary changes. ## Database SYZOJ 2 uses [Sequelize](http://sequelizejs.com), which supports many database systems, including MySQL and Sqlite. diff --git a/modules/submission.js b/modules/submission.js index ad8943d..aa2e961 100644 --- a/modules/submission.js +++ b/modules/submission.js @@ -149,6 +149,7 @@ app.get('/submission/:id', async (req, res) => { judge.allowedRejudge = await judge.problem.isAllowedEditBy(res.locals.user); judge.allowedManage = await judge.problem.isAllowedManageBy(res.locals.user); + let hideScore = false; if (contest) { let problems_id = await contest.getProblems(); judge.problem_id = problems_id.indexOf(judge.problem_id) + 1; @@ -158,10 +159,13 @@ app.get('/submission/:id', async (req, res) => { if (!['Compile Error', 'Waiting', 'Compiling'].includes(judge.status)) { judge.status = 'Submitted'; } + + hideScore = true; } } res.render('submission', { + hideScore, hideScore, contest: contest, judge: judge }); @@ -197,6 +201,7 @@ app.get('/submission/:id/ajax', async (req, res) => { judge.allowedRejudge = await judge.problem.isAllowedEditBy(res.locals.user); judge.allowedManage = await judge.problem.isAllowedManageBy(res.locals.user); + let hideScore = false; if (contest) { let problems_id = await contest.getProblems(); judge.problem_id = problems_id.indexOf(judge.problem_id) + 1; @@ -206,10 +211,13 @@ app.get('/submission/:id/ajax', async (req, res) => { if (!['Compile Error', 'Waiting', 'Compiling'].includes(judge.status)) { judge.status = 'Submitted'; } + + hideScore = true; } } res.render('submission_content', { + hideScore, hideScore, contest: contest, judge: judge }); diff --git a/views/submission_content.ejs b/views/submission_content.ejs index aad2c2d..3ca2274 100644 --- a/views/submission_content.ejs +++ b/views/submission_content.ejs @@ -36,12 +36,14 @@ else problemUrl = syzoj.utils.makeUrl(['problem', judge.problem_id]); 编号 题目名称 状态 - <% if ((typeof contest === 'undefined' || !contest) || !((!user || !user.is_admin) && !contest.ended && (contest.type === 'acm' || contest.type === 'noi'))) { %> + <% if ((typeof contest === 'undefined' || !contest) || !((!user || !user.is_admin) && !contest.ended && contest.type === 'acm') && !hideScore) { %> 分数 <% } %> <% if (judge.problem.type !== 'submit-answer') { %> - 总时间 - 内存 + <% if (!hideScore) { %> + 总时间 + 内存 + <% } %> 代码 <% } else { %> 文件大小 @@ -58,12 +60,14 @@ else problemUrl = syzoj.utils.makeUrl(['problem', judge.problem_id]); <%= judge.status %> - <% if ((typeof contest === 'undefined' || !contest) || !((!user || !user.is_admin) && !contest.ended && (contest.type === 'acm' || contest.type === 'noi'))) { %> + <% if ((typeof contest === 'undefined' || !contest) || !((!user || !user.is_admin) && !contest.ended && contest.type === 'acm') && !hideScore) { %> <%= judge.result.score %> <% } %> <% if (judge.problem.type !== 'submit-answer') { %> - <%= judge.result.total_time %> ms - <%= parseInt(judge.result.max_memory) || 0 %> K + <% if (!hideScore) { %> + <%= judge.result.total_time %> ms + <%= parseInt(judge.result.max_memory) || 0 %> K + <% } %> <% if (judge.allowedSeeCode) { %> <%= syzoj.config.languages[judge.language].show %> / <%= syzoj.utils.formatSize(judge.codeLength) %> <% } else { %> diff --git a/views/submissions_item.ejs b/views/submissions_item.ejs index 456d400..8de86f6 100644 --- a/views/submissions_item.ejs +++ b/views/submissions_item.ejs @@ -18,18 +18,18 @@ textFit(e, { maxFontSize: 14 }); <% if ((typeof contest === 'undefined' || !contest) || !((!user || !user.is_admin) && !contest.ended && (contest.type === 'acm' || contest.type === 'noi'))) { %> <%= judge.result.score %> -<% } %> -<% if (judge.problem.type !== 'submit-answer') { %> -<%= judge.result.total_time %> ms -<%= parseInt(judge.result.max_memory) || 0 %> K -<% if (judge.allowedSeeCode) { %> - <%= syzoj.config.languages[judge.language].show %> / <%= syzoj.utils.formatSize(judge.code.length) %> -<% } else { %> - <%= syzoj.config.languages[judge.language].show %> / 隐藏 -<% } %> -<% } else { %> --- -<%= syzoj.utils.formatSize(judge.max_memory) %> + <% if (judge.problem.type !== 'submit-answer') { %> + <%= judge.result.total_time %> ms + <%= parseInt(judge.result.max_memory) || 0 %> K + <% if (judge.allowedSeeCode) { %> + <%= syzoj.config.languages[judge.language].show %> / <%= syzoj.utils.formatSize(judge.code.length) %> + <% } else { %> + <%= syzoj.config.languages[judge.language].show %> / 隐藏 + <% } %> + <% } else { %> + -- + <%= syzoj.utils.formatSize(judge.max_memory) %> + <% } %> <% } %> <%= judge.user.username %><% if (judge.user.nameplate) { %><%- judge.user.nameplate %><% } %> <%= syzoj.utils.formatDate(judge.submit_time) %>