diff --git a/models/judge_state.js b/models/judge_state.js index 6cdf122..af62a28 100644 --- a/models/judge_state.js +++ b/models/judge_state.js @@ -161,18 +161,6 @@ class JudgeState extends Model { } } - async updateResult(result) { - this.score = result.score; - this.pending = result.pending; - this.status = result.status; - if (this.language) { - // language is empty if it's a submit-answer problem - this.total_time = result.total_time; - this.max_memory = result.max_memory; - } - this.result = result; - } - async updateRelatedInfo(newSubmission) { await syzoj.utils.lock(['JudgeState::updateRelatedInfo', 'problem', this.problem_id], async () => { await syzoj.utils.lock(['JudgeState::updateRelatedInfo', 'user', this.user_id], async () => { diff --git a/modules/api_v2.js b/modules/api_v2.js index 54c0c41..e1f2e98 100644 --- a/modules/api_v2.js +++ b/modules/api_v2.js @@ -155,30 +155,6 @@ app.apiRouter.post('/api/v2/judge/peek', async (req, res) => { } }); -app.apiRouter.post('/api/v2/judge/update/:id', async (req, res) => { - try { - if (req.query.session_id !== syzoj.config.judge_token) return res.status(404).send({ err: 'Permission denied' }); - - if (req.body.type === 'custom-test') { - let CustomTest = syzoj.model('custom_test'); - let custom_test = CustomTest.fromID(req.params.id); - await custom_test.updateResult(JSON.parse(req.body.result)); - await custom_test.save(); - } else if (req.body.type === 'submission') { - let JudgeState = syzoj.model('judge_state'); - let judge_state = await JudgeState.fromID(req.params.id); - await judge_state.updateResult(JSON.parse(req.body.result)); - await judge_state.save(); - await judge_state.updateRelatedInfo(); - } - - res.send({ return: 0 }); - } catch (e) { - syzoj.log(e); - res.status(500).send(e); - } -}); - app.apiRouter.post('/api/v2/judge/update2', async (req, res) => { try { if (req.get('Token') !== syzoj.config.judge_token) return res.status(403).send({ err: 'Incorrect token' });