|
|
@ -3,10 +3,12 @@ const enums = require('./enums'), |
|
|
|
url = require('url'); |
|
|
|
url = require('url'); |
|
|
|
|
|
|
|
|
|
|
|
module.exports.judge = async function (judge_state, priority) { |
|
|
|
module.exports.judge = async function (judge_state, priority) { |
|
|
|
let type, param; |
|
|
|
let type, param, extraFile = null; |
|
|
|
switch (judge_state.problem.type) { |
|
|
|
switch (judge_state.problem.type) { |
|
|
|
case 'submit-answer': |
|
|
|
case 'submit-answer': |
|
|
|
type = enums.ProblemType.AnswerSubmission; |
|
|
|
type = enums.ProblemType.AnswerSubmission; |
|
|
|
|
|
|
|
param = null; |
|
|
|
|
|
|
|
extraFile = 'static/uploads/answer/' + judge_state.code; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'interaction': |
|
|
|
case 'interaction': |
|
|
|
type = enums.ProblemType.Interaction; |
|
|
|
type = enums.ProblemType.Interaction; |
|
|
@ -25,11 +27,14 @@ module.exports.judge = async function (judge_state, priority) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const req = { |
|
|
|
const req = { |
|
|
|
|
|
|
|
content: { |
|
|
|
taskId: judge_state.id, |
|
|
|
taskId: judge_state.id, |
|
|
|
testData: judge_state.problem.id.toString(), |
|
|
|
testData: judge_state.problem.id.toString(), |
|
|
|
type: type, |
|
|
|
type: type, |
|
|
|
priority: priority, |
|
|
|
priority: priority, |
|
|
|
param: param |
|
|
|
param: param |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
extraFileLocation: extraFile |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
await rp(url.resolve(syzoj.config.judge_server_addr, "/daemon/task"), { |
|
|
|
await rp(url.resolve(syzoj.config.judge_server_addr, "/daemon/task"), { |
|
|
|