diff --git a/libs/submissions_process.js b/libs/submissions_process.js index e3d56c3..6203d1e 100644 --- a/libs/submissions_process.js +++ b/libs/submissions_process.js @@ -1,19 +1,22 @@ const {getCachedJudgeState} = require('./judger'); const _ = require('lodash'); -const getSubmissionInfo = (s, displayConfig) => ({ - submissionId: s.id, - taskId: s.task_id, - user: s.user.username, - userId: s.user_id, - problemName: s.problem.title, - problemId: s.problem_id, - language: displayConfig.showCode ? ((s.language != null && s.language !== '') ? syzoj.languages[s.language].show : null) : null, - codeSize: displayConfig.showCode ? s.code_length : null, - submitTime: syzoj.utils.formatDate(s.submit_time), - isPractice: s.is_practice, - c_id: s.c_id -}); +const getSubmissionInfo = (s, displayConfig) => { + return { + submissionId: s.id, + taskId: s.task_id, + user: s.user.username, + userId: s.user_id, + problemName: s.problem.title, + problemId: s.problem_id, + language: displayConfig.showCode ? ((s.language != null && s.language !== '') ? syzoj.languages[s.language].show : null) : null, + codeSize: displayConfig.showCode ? s.code_length : null, + submitTime: syzoj.utils.formatDate(s.submit_time), + isPractice: s.is_practice, + c_id: s.c_id, + is_share: s.is_share || false + } +}; const getRoughResult = (x, displayConfig, roughOnly) => { let max = 0; diff --git a/modules/contest.js b/modules/contest.js index 85c9ec9..656c772 100644 --- a/modules/contest.js +++ b/modules/contest.js @@ -53,6 +53,7 @@ app.get('/contest/:id/edit', async (req, res) => { res.render('contest_edit', { contest: contest, problems: problems, + contest_id, admins: admins }); } catch (e) { @@ -63,6 +64,17 @@ app.get('/contest/:id/edit', async (req, res) => { } }); +app.get('/api/contest/problem/:id', async (req, res) => { + try { + const id = req.params.id; + let contest = await Contest.findById(id); + let problems = await contest.problems.split('|').mapAsync(async id => await Problem.findById(id)); + res.send({ problems}); + } catch(e) { + res.send({ error_code: e.errno, error_msg: '失败' }); + } +}) + app.post('/contest/:id/edit', async (req, res) => { try { if (!res.locals.user || !res.locals.user.is_admin) throw new ErrorMessage('您没有权限进行此操作。'); @@ -96,7 +108,7 @@ app.post('/contest/:id/edit', async (req, res) => { if (!req.body.title.trim()) throw new ErrorMessage('比赛名不能为空。'); contest.title = req.body.title; contest.subtitle = req.body.subtitle; - if (!Array.isArray(req.body.problems)) req.body.problems = [req.body.problems]; + if (!Array.isArray(req.body.problems) && typeof req.body.problems==='string') req.body.problems = req.body.problems.split(','); if (!Array.isArray(req.body.admins)) req.body.admins = [req.body.admins]; contest.problems = req.body.problems.join('|'); contest.admins = req.body.admins.join('|'); diff --git a/modules/submission.js b/modules/submission.js index 9cab27a..f916f5c 100644 --- a/modules/submission.js +++ b/modules/submission.js @@ -84,6 +84,11 @@ app.get('/submissions', async (req, res) => { query.andWhere('status = :status', { status: req.query.status }); isFiltered = true; } + + if (req.query.isshare) { + query.andWhere('is_share = :status', { status: req.query.isshare }); + } + if (!inContest && (!curUser || !await curUser.hasPrivilege('manage_problem'))) { if (req.query.problem_id) { diff --git a/views/admin_classify.ejs b/views/admin_classify.ejs index 6310d9b..1e40705 100644 --- a/views/admin_classify.ejs +++ b/views/admin_classify.ejs @@ -71,6 +71,7 @@ :total="problemCount"> + @@ -112,6 +113,7 @@ +<% include problem_table %> + + + + <% if (syzoj.config.google_analytics && syzoj.config.google_analytics !== 'UA-XXXXXXXX-X') { %> + + diff --git a/views/submissions.ejs b/views/submissions.ejs index e58d22f..c4bb7c8 100644 --- a/views/submissions.ejs +++ b/views/submissions.ejs @@ -1,6 +1,12 @@ <% this.title = '提交记录' %> <% include header %> <% include util %> +
是否已经分享 | 编号 | 题目 | 状态 | @@ -133,11 +155,14 @@ $(function () { $('#select_language').dropdown(); $('#select_status').dropdown(); + $('#select_share').dropdown(); }); const itemList = <%- serializejs(items) %>; const socketUrl = "/rough"; const displayConfig = <%- serializejs(displayConfig) %>; +console.log(itemList); + const vueApp = new Vue({ el: '#vueAppFuckSafari', data: { diff --git a/views/submissions_item.ejs b/views/submissions_item.ejs index 4ed15a0..5c8c2fe 100644 --- a/views/submissions_item.ejs +++ b/views/submissions_item.ejs @@ -66,6 +66,7 @@
---|