These are chat archives for ecjs/Concierge

14th
Nov 2014
Joe Elsey
@joeelsey
Nov 14 2014 00:42
Just to confirm we are all meeting tomorrow at 2pm? What floor?
Mark Harrell
@ecjs
Nov 14 2014 00:47
Co-working might be good
or the easy..and use the projector
Joe Elsey
@joeelsey
Nov 14 2014 00:49
If the easy is available we should take it. If not we'll go to the co working section.
Sounds like a plan
Mark Harrell
@ecjs
Nov 14 2014 01:22
cool
check out heroku scheduler
I think it can be a decent replacement for our node npm app
Joe Elsey
@joeelsey
Nov 14 2014 01:27
Price is a bit steep.
10 minutes is the small interval?
Mark Harrell
@ecjs
Nov 14 2014 01:29
I dont see a price on it/I think its free
Joe Elsey
@joeelsey
Nov 14 2014 01:29
I should add a sarcastic tag to comments like mine above.
Known issues: cheduler has a known issue whereby scheduled processes are occasionally skipped.
So, would be a good short term solution
Mark Harrell
@ecjs
Nov 14 2014 01:31
its only every 10 minutes
cant use that
Joe Elsey
@joeelsey
Nov 14 2014 01:31
No tutorial for node...
I wonder how hard creating the custom clock process would be?'
Mark Harrell
@ecjs
Nov 14 2014 01:32
going to read up now..
it looks like nodecron
might be great
Mark Harrell
@ecjs
Nov 14 2014 02:55
currently have node cron working
console logging every minute on my heroku server
works just fine
Joe Elsey
@joeelsey
Nov 14 2014 03:10
Charles brought up an interesting point. What if we used the clock on the phone of the user. Instead of a back end db checking a list of call jobs. Have the call job client side and send a get request for the call? Or something like that. We can talk about that tomorrow I guess.
Mark Harrell
@ecjs
Nov 14 2014 03:46
app isnt always open
the problem being what if the app is closed..
Joe Elsey
@joeelsey
Nov 14 2014 03:47
true.
Mark Harrell
@ecjs
Nov 14 2014 03:55
I think we solve the time problem by using momentjs.com
and using the npm module for it
and setting time in UTC time
easy manipulation of the date object, ultimately a lot more readable
on the iOS side, they will have to show the user their local time, but submit that users UTC time
moment also has query functions
Mark Harrell
@ecjs
Nov 14 2014 04:13
so here is a simple Moment.js function
function checkJob(date) {
  var current = moment(date).utc().format();
  var later = moment().add(1, 'days').utc().format();

  if (moment(current).isBefore(moment(later))) {
    console.log(current);
    console.log(later);
  }
}
what this does, is lets you pass in a time into the checkJob date param..(it should already be in UTC format)…and it will compare that to 1 day from now.
Mark Harrell
@ecjs
Nov 14 2014 04:18
so actually I want to refactor this function, to take my incoming date, and check if it is within 1 day of (today):
function addToQueue(date) {
  var jobDate = moment(date).utc().format();
  var later = moment().add(1, 'days').utc().format();

  if (moment(jobDate).isAfter(moment(later))) {
    console.log(jobDate);
    console.log(later);
  }
}
in the if statement, we run a database query that copies the job to the Queue.
we then create another function, that says if the job is within the next 5 minutes, setup the Twilio call.
Mark Harrell
@ecjs
Nov 14 2014 04:43
some updated code for your perusal:
function addToQueue(date) {
  var jobDate = moment(date).utc().format();
  var later = moment().add(1, 'days').utc().format();
  // if the job date is within the next 24 hrs, add to Queue
  if (moment(jobDate).isBefore(moment(later))) {
    console.log('Sending to Queue: ' + jobDate);
  }
}

function sendToTwilio(date) {
  var jobDate = moment(date).utc().format();
  var later = moment().add(5, 'minutes').utc().format();
  // if the job date is within the next 5 minutes, send to Twilio
  if (moment(jobDate).isBefore(moment(later))) {
    console.log('Sending to Twilio: ' + jobDate);
  }
}
Vincent
@vlee90
Nov 14 2014 16:53
Turns out iOS gets out at 1pm this afternoon. I could meet after that. Or if you guys are available I could meet at 10am this morning for an hour.
Joe Elsey
@joeelsey
Nov 14 2014 18:00
We're in the job meeting right now. What about 2pm?
Vincent
@vlee90
Nov 14 2014 18:05
2pm sounds good.
Joe Elsey
@joeelsey
Nov 14 2014 21:36
mark. do you have a git link for the project?
just merged dev into master
we should talk a little bit about our git structure today
branches, etc.