MCPcopy
hub / github.com/skygragon/leetcode-cli / doTask

Function doTask

lib/commands/submission.js:56–79  ·  view source on GitHub ↗
(problem, queue, cb)

Source from the content-addressed store, hash-verified

54};
55
56function doTask(problem, queue, cb) {
57 const argv = queue.ctx.argv;
58
59 function onTaskDone(e, msg) {
60 // NOTE: msg color means different purpose:
61 // - red: error
62 // - green: accepted, fresh download
63 // - yellow: not ac-ed, fresh download
64 // - white: existed already, skip download
65 log.printf('[%=4s] %-60s %s', problem.fid, problem.name,
66 (e ? chalk.red('ERROR: ' + (e.msg || e)) : msg));
67 if (cb) cb(e);
68 }
69
70 if (argv.extra) {
71 // have to get problem details, e.g. problem description.
72 core.getProblem(problem.fid, function(e, problem) {
73 if (e) return cb(e);
74 exportSubmission(problem, argv, onTaskDone);
75 });
76 } else {
77 exportSubmission(problem, argv, onTaskDone);
78 }
79}
80
81function exportSubmission(problem, argv, cb) {
82 core.getSubmissions(problem, function(e, submissions) {

Callers

nothing calls this directly

Calls 2

cbFunction · 0.85
exportSubmissionFunction · 0.85

Tested by

no test coverage detected