updated
This commit is contained in:
Родитель
6ef0fcbed2
Коммит
f7fc5f374e
|
@ -34,7 +34,10 @@ module.exports = {
|
|||
// last 6 hours; 60 minutes
|
||||
var since = new Date(now - 360 * 60000).toISOString();
|
||||
|
||||
console.log('getCurrentBac: ' + userName);
|
||||
|
||||
postgres.get_recentCheckins(userName, since, function(recentCheckins) {
|
||||
|
||||
var earliestDrinkAt = new Date(recentCheckins.rows[0].consumed_at__c);
|
||||
var totalTimeInHours = Math.abs(now - earliestDrinkAt) / 36e5;
|
||||
|
||||
|
|
|
@ -106,11 +106,7 @@ module.exports = function(app) {
|
|||
var trigger = require('./apis/trigger');
|
||||
|
||||
trigger.insertNewCheckins(function(result) {
|
||||
console.log('test1');
|
||||
console.log(result);
|
||||
trigger.processNewCheckins(function(result2) {
|
||||
console.log('test2');
|
||||
console.log(result2);
|
||||
response.send('ok');
|
||||
});
|
||||
});
|
||||
|
@ -177,7 +173,7 @@ module.exports = function(app) {
|
|||
|
||||
if (body.toLowerCase().indexOf('cool') !== -1)
|
||||
{
|
||||
message = 'To get your current BAC, send "bac". To add a drink w/o Untapped send "new {oz} {abv}". To change # of oz, send "last {oz}". To understand the impact of a beer, send "impact {oz} {ab}".';
|
||||
message = 'To get your current BAC, send "bac". To add a drink w/o Untapped send "new {oz} {abv}". To change # of oz, send "last {oz}". To understand the impact of a beer, send "impact {oz} {abv}".';
|
||||
twiml.message(message);
|
||||
response.send(twiml);
|
||||
|
||||
|
|
|
@ -13,18 +13,19 @@ describe('Trigger', function() {
|
|||
});
|
||||
|
||||
describe('New Checkins', function() {
|
||||
// it('should check for new checkins and insert into database', function(done) {
|
||||
it('should check for new checkins and insert into database', function(done) {
|
||||
|
||||
// trigger.insertNewCheckins(function(results) {
|
||||
// console.log('back');
|
||||
// done();
|
||||
// });
|
||||
// });
|
||||
trigger.insertNewCheckins(function(results) {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should process new checkins and send updated BAC values', function(done) {
|
||||
|
||||
trigger.processNewCheckins(function(results) {
|
||||
done();
|
||||
trigger.insertNewCheckins(function(results) {
|
||||
trigger.processNewCheckins(function(results2) {
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче