Added phone to parse phone
This commit is contained in:
Родитель
b76bb7c029
Коммит
578b8dc372
|
@ -15,6 +15,7 @@
|
|||
"express": "4.13.4",
|
||||
"moment": "2.13.0",
|
||||
"pg": "4.5.3",
|
||||
"phone": "^1.0.8",
|
||||
"request": "2.72.0",
|
||||
"requestify": "0.1.17",
|
||||
"sleep": "^3.0.1",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
var postgres = require('../db/postgres.js');
|
||||
var phone = require('phone');
|
||||
|
||||
module.exports = {
|
||||
get: function (request, response) {
|
||||
|
@ -11,7 +12,7 @@ module.exports = {
|
|||
|
||||
console.log(' weight: ' + weight);
|
||||
console.log(' isMale: ' + isMale);
|
||||
console.log(' mobilePhone: ' + mobilePhone);
|
||||
console.log(' mobilePhone: ' + phone(mobilePhone)[0]);
|
||||
|
||||
var updated = false;
|
||||
response.render('pages/profile', {weight, isMale, mobilePhone, updated});
|
||||
|
@ -26,7 +27,7 @@ module.exports = {
|
|||
isMale = false;
|
||||
if (gender == "Male") { isMale = true; }
|
||||
|
||||
postgres.update_profile(response.locals.userName, weight, isMale, mobilePhone, function(result) {
|
||||
postgres.update_profile(response.locals.userName, weight, isMale, phone(mobilePhone)[0], function(result) {
|
||||
|
||||
var updated = true;
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ module.exports = {
|
|||
var authToken = process.env.TWILIO_TOKEN;
|
||||
var fromPhoneNumber = process.env.TWILIO_PHONENUMBER;
|
||||
var sendTxt = process.env.SEND_TXT;
|
||||
var message = 'You just checked in! You started drinking ' + totalTimeInHours.toFixed(2) + ' hours ago and drank ' + count + ' beers. Your bac is ' + bacAfterElapsedTime.toFixed(3) + '. Txt "COOL" for commands.';
|
||||
var message = 'You just checked in! You started drinking ' + totalTimeInHours.toFixed(2) + ' hours ago and drank ' + count + ' beers. Your bac is ' + bacAfterElapsedTime.toFixed(3) + '. Send "COOL" for commands.';
|
||||
|
||||
console.log(userName + ': ' + message);
|
||||
|
||||
|
|
|
@ -175,11 +175,11 @@ module.exports = function(app) {
|
|||
|
||||
if (body.toLowerCase().indexOf('cool') !== -1)
|
||||
{
|
||||
message = 'To get your current BAC, txt "bac". To add a drink w/o Untapped txt "new {oz} {abv}".';
|
||||
message = 'To get your current BAC, send "bac". To add a drink w/o Untapped send "new {oz} {abv}".';
|
||||
} else if (body.toLowerCase().indexOf('bac') !== -1) {
|
||||
message = 'Prompt bac calc in progress';
|
||||
message = 'Prompt bac calc in progress.';
|
||||
} else if (body.toLowerCase().indexOf('new') !== -1) {
|
||||
message = 'new addition in progress';
|
||||
message = 'Ability to add new beers in progress.';
|
||||
} else {
|
||||
message = 'We did not understand. Txt "COOL" for commands.';
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче