diff --git a/lib/plugins/leetcode.js b/lib/plugins/leetcode.js index 24331ec6..37660f68 100644 --- a/lib/plugins/leetcode.js +++ b/lib/plugins/leetcode.js @@ -230,7 +230,13 @@ function verifyResult(task, queue, cb) { let result = JSON.parse(body); if (result.state === 'SUCCESS') { - result = formatResult(result); + if (task.type === 'Actual') { + result = formatResult(result); + } else if (task.type === 'Expected') { + let expected_answer = result.expected_code_answer || ''; + result = formatResult(result); + result.answer = expected_answer; + } _.extendOwn(result, task); queue.ctx.results.push(result); } else { @@ -288,7 +294,7 @@ plugin.testProblem = function(problem, cb) { const tasks = [ {type: 'Actual', id: task.interpret_id}, - {type: 'Expected', id: task.interpret_expected_id} + {type: 'Expected', id: task.interpret_id} ]; const q = new Queue(tasks, {opts: opts, results: []}, verifyResult); q.run(null, function(e, ctx) {