8000 [bugfix] Bug fix for #184, #192 by HwangTaehyun · Pull Request #214 · skygragon/leetcode-cli · GitHub
[go: up one dir, main page]

Skip to content

[bugfix] Bug fix for #184, #192 #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[bugfix] Bug fix for #184, #192
- Bug fix for test command freezing issue
  - There seems to have been some changes in response for leetcode test api.
    - leetcode test url's response doesn't have "interpret_expected_id"
    - leetcode verify url's response have test's expected results (ex. expected answer)
  • Loading branch information
HwangTaehyun committed Jun 28, 2020
commit 82bf480af6fa54224ebb15a3da993b13c24c099a
10 changes: 8 additions & 2 deletions lib/plugins/leetcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down
0