Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c8d2760

Browse files
committed
Update comments
1 parent f6b6f2f commit c8d2760

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lib/commands/list.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ cmd.handler = function(argv) {
7575
}
7676
problems = problems.filter(x => x.name.toLowerCase().includes(word));
7777
}
78+
//prepare for csvWriter
7879
const csvWriter = createCsvWriter({
7980
path: argv.output,
8081
header: [
@@ -101,6 +102,7 @@ cmd.handler = function(argv) {
101102
if (problem.locked) ++stat.locked;
102103
if (problem.starred) ++stat.starred;
103104

105+
//build data for csvWriter
104106
if(argv.csv){
105107
if(problem.companyStats!=null){
106108
data.push( {id:problem.fid,
@@ -121,9 +123,6 @@ cmd.handler = function(argv) {
121123
level: problem.level,
122124
tags: problem.tags,
123125
companies: problem.companies,
124-
// companies06: problem.companyStats["1"].join(','),
125-
// companies612: problem.companyStats["1"].join(',')+problem.companyStats["2"].join(','),
126-
// companies1224: problem.companyStats["1"].join(',')+problem.companyStats["2"].join(',')+problem.companyStats["3"].join(','),
127126
percent: problem.percent.toFixed(2),
128127
category: problem.category
129128
});
@@ -158,7 +157,7 @@ cmd.handler = function(argv) {
158157
log.printf('%12s%s', ' ', chalk.gray(buf.join(' | ')));
159158
}
160159
}
161-
160+
//write data to csv
162161
if(argv.csv){
163162
csvWriter
164163
.writeRecords(data)

lib/plugins/leetcode.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ plugin.getProblems = function(cb) {
8080

8181
plugin.getCategoryProblems = function(category, cb) {
8282
const user = session.getUser();
83-
if (!user.paid){
83+
if (!user.paid){ // for non-vip user, use restful api method.
8484
log.debug('running leetcode.getCategoryProblems: ' + category);
8585
const opts = plugin.makeOpts(config.sys.urls.problems.replace('$category', category));
8686

@@ -120,6 +120,7 @@ plugin.getCategoryProblems = function(category, cb) {
120120
});
121121
}
122122
else{
123+
// for vip user, use graphql api method to get company related info.
123124
log.debug('running leetcode.getCategoryProblems with Paid User: ' + category);
124125

125126
category = category.charAt(0).toUpperCase() + category.slice(1)
@@ -139,6 +140,8 @@ plugin.getCategoryProblems = function(category, cb) {
139140
if (e) return cb(e);
140141

141142
const json = body;
143+
144+
// generate problem list with stared.
142145
var starList =[]
143146
for(var favorList in json.data.favoritesLists.privateFavorites){
144147
for(var question in favorList.questions){
@@ -151,6 +154,7 @@ plugin.getCategoryProblems = function(category, cb) {
151154
.filter(p => p.categoryTitle==category)
152155
.map(function(p) {
153156
var stats = JSON.parse(p.stats)
157+
// generate companyStats value.
154158
var companyStats = JSON.parse(p.companyTagStats)
155159
for (var val in companyStats){
156160
companyStats[val] = companyStats[val].map(function(p){

0 commit comments

Comments
 (0)