Skip to content

Commit

Permalink
Merge pull request #169 from lebeier/stat-graph-row-number-format-fix
Browse files Browse the repository at this point in the history
fixed the row number format for `leetcode stat -g`
  • Loading branch information
skygragon authored Sep 28, 2019
2 parents 5a27061 + fe9a9a9 commit d30a136
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/commands/stat.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ function showGraph(problems) {
for (let problem of problems)
graph[problem.fid] = ICONS[problem.state] || ICONS.none;

let line = [sprintf(' %03s', 0)];
let rowNumFormat = ' %04s';
let line = [sprintf(rowNumFormat, 0)];
for (let i = 1, n = graph.length; i <= n; ++i) {
// padding before group
if (i % 10 === 1) line.push(' ');
Expand All @@ -114,7 +115,7 @@ function showGraph(problems) {
// time to start new row
if (i % (10 * groups) === 0 || i === n) {
log.info(line.join(' '));
line = [sprintf(' %03s', i)];
line = [sprintf(rowNumFormat, i)];
}
}

Expand Down

0 comments on commit d30a136

Please sign in to comment.