Skip to content

Commit 705832c

Browse files
author
Bogdan Abaev
committed
changed time format saved in db, ready for alexa reporting
1 parent 2bac148 commit 705832c

File tree

936 files changed

+121239
-114
lines changed

Some content is hidden

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

936 files changed

+121239
-114
lines changed
File renamed without changes.

CLI/CLI.js renamed to client/CLI.js

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
const yargs = require('yargs')
22
const request = require('request')
33
const fs = require('fs');
4-
//host = "http://localhost:3000";
5-
host = "http://54.237.77.73:80";
6-
path = "/Users/bogdanabaev/RandomProgramming/node/notes/CLI/";
4+
host = "http://localhost:3000";
5+
//host = "http://54.237.77.73:80";
6+
path = "/Users/bogdanabaev/RandomProgramming/node/notes/client/";
77

88

99
// BUG: BREAKS WITH SIGNUP CAUSE THERE IS NO 'TIME' AFTER DATA
10-
//BUG: breaks when send request with nonexisting user name
1110

12-
// lambda - entry point. There construct query, send it to server from there.
1311
const sendQuery = function (query, username, signup) {
1412
if (username) {
1513
request.post({
@@ -176,26 +174,16 @@ yargs.command({
176174
try {
177175
username = fs.readFileSync(path + '.username.txt').toString();
178176
var query = `{
179-
time(username: "${username}"){
180-
report(days: ${argv.days}){
177+
time(username: ${username}){
178+
report(days:${days}){
181179
_id
180+
totalTime
181+
brief{
182182
timeSpent
183-
workSessions{
184-
duration
185-
start{
186-
year
187-
month
188-
day
189-
time
190-
}
191-
finish{
192-
year
193-
month
194-
day
195-
time
183+
day
184+
196185
}
197-
}
198-
}
186+
}
199187
}
200188
}`;
201189
} catch (e) {

CLI/alexa_lambda.js renamed to client/alexa_lambda.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@ const sendQuery = function(query, handlerInput) {
3232
});
3333
output = temp;
3434
} else if (handlerInput.requestEnvelope.request.intent.name == "report"){
35-
35+
const days = handlerInput.requestEnvelope.request.intent.slots.days.value;
36+
var temp = `Here is the breakdown of your activities for the last ${days} days:\n`;
37+
output.forEach((prj) => {
38+
temp += `You spent total of ${prj.totalTime} minutes on ${prj._id}`;
39+
prj.brief.forEach((session)=>{
40+
temp += `${session.timeSpent} minutes spent on day ${session.day} `
41+
});
42+
});
43+
output = temp;
3644
}
3745
console.log("Result");
3846
console.log(output);
@@ -236,6 +244,21 @@ const reportIntentHandler = {
236244
&& handlerInput.requestEnvelope.request.intent.name === 'report';
237245
},
238246
handle(handlerInput) {
247+
var query=`{
248+
time(username: "username"){
249+
report(days: 4){
250+
_id
251+
timeSpent
252+
workSessions{
253+
duration
254+
start{
255+
day
256+
time
257+
}
258+
}
259+
}
260+
}
261+
}`;
239262
return sendQuery(query,handlerInput);
240263
}
241264
};
File renamed without changes.

client/node_modules/.bin/semver

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/node_modules/.bin/sshpk-conv

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/node_modules/.bin/sshpk-sign

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/node_modules/.bin/sshpk-verify

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/node_modules/.bin/uuid

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/node_modules/.bin/which

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)