(problem, queue, cb)
| 54 | }; |
| 55 | |
| 56 | function 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 | |
| 81 | function exportSubmission(problem, argv, cb) { |
| 82 | core.getSubmissions(problem, function(e, submissions) { |
nothing calls this directly
no test coverage detected