Skip to content

Commit 6454c4b

Browse files
author
Bogdan Abaev
committed
minor fix to the CLI
1 parent 76d90cd commit 6454c4b

File tree

265 files changed

+18497
-12535
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

265 files changed

+18497
-12535
lines changed

client/CLI.js

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
const yargs = require('yargs')
55
const request = require('request')
66
const fs = require('fs');
7-
host = "http://localhost:3000";
8-
//host = "http://54.237.77.73:80";
7+
//host = "http://localhost:3000";
8+
host = "http://54.237.77.73:80";
99
path = "/Users/bogdanabaev/RandomProgramming/node/notes/client/";
1010

1111

@@ -174,15 +174,15 @@ yargs.command({
174174
var username = '';
175175
try {
176176
username = fs.readFileSync(path + '.username.txt').toString();
177-
var query = `{
178-
time(username: ${username}){
179-
report(days:${days}){
177+
var query=`{
178+
time(username: "${username}" ){
179+
report(days:${argv.days}){
180180
_id
181181
totalTime
182182
brief{
183183
timeSpent
184184
day
185-
185+
month
186186
}
187187
}
188188
}
@@ -204,20 +204,14 @@ yargs.command({
204204
console.log(err);
205205
} else {
206206
const dict = JSON.parse(result.body).data.time.report;
207-
for (var project in dict) {
208-
console.log("\nProject: " + dict[project]._id);
209-
var minSpent = dict[project].timeSpent;
210-
var hr = parseInt(minSpent / 60);
211-
var min = minSpent % 60;
212-
console.log(`Total time: ${hr}:${min}`);
213-
console.log("Work sessions:\n");
214-
dict[project].workSessions.forEach(session => {
215-
console.log(`Start:${session.start.day}/${session.start.month} at ${session.start.time}`);
216-
console.log(session.finish ? `Finish:${session.finish.day}/${session.finish.month} at ${session.finish.time}` : "In progress");
217-
console.log(session.duration ? `Duration: ${parseInt(session.duration / 60)}:${session.duration % 60} ` : "");
218-
console.log("-------------------------------------\n");
207+
var temp = "Your activities: \n";
208+
dict.forEach((prj) => {
209+
temp += `\nYou spent total of ${prj.totalTime} minutes on ${prj._id}\n `;
210+
prj.brief.forEach((session)=>{
211+
temp += `--${session.timeSpent} minutes spent on day ${session.day}\n `
219212
});
220-
}
213+
});
214+
console.log(temp);
221215
}
222216
})
223217
} else {

client/node_modules/.bin/semver

Lines changed: 0 additions & 1 deletion
This file was deleted.

client/node_modules/.bin/which

Lines changed: 0 additions & 1 deletion
This file was deleted.

client/node_modules/ajv/README.md

Lines changed: 19 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)