Skip to content

Commit

Permalink
added some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
frogermcs committed Oct 26, 2017
1 parent ca3d1af commit 6c7eb3c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions functions/conversation.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Conversation {
this.waterLog = waterLog;
}

//Intent input.welcome
actionWelcomeUser() {
return this.userManager.isFirstUsage(this._getCurrentUserId())
.then(isFirstUsage => {
Expand Down Expand Up @@ -36,9 +37,15 @@ class Conversation {
});
}

//Intent log_water
actionLogWater() {
//Get argument extracted by Dialogflow
let waterToLog = this.dialogflowApp.getArgument(ARG_WATER_VOLUME);
//Save logged water into Firebase Realtime Database
this.waterLog.saveLoggedWater(this._getCurrentUserId(), waterToLog);
//Load sum of logged water for current user and reply user
//with how much water he or she logged so far.
//End the conversation.
return this.waterLog.getLoggedWaterForUser(this._getCurrentUserId())
.then(loggedWater => {
this.dialogflowApp.tell(
Expand All @@ -51,6 +58,7 @@ class Conversation {
});
}

//Intent get_logged_water
actionGetLoggedWater() {
return this.waterLog.getLoggedWaterForUser(this._getCurrentUserId())
.then(loggedWater => this.dialogflowApp.tell(util.format(Str.WATER_LOGGED_OVERALL, loggedWater)));
Expand Down

0 comments on commit 6c7eb3c

Please sign in to comment.