Created
October 17, 2016 14:02
-
-
Save tomrandle/eae8767a4c8ce6c15f2c4b201c797a32 to your computer and use it in GitHub Desktop.
lunchReminder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function lunchReminder() { | |
var curHour = new Date().getHours(); | |
if (curHour > 17 || curHour < 9) { | |
Logger.log("Outside work hours stopping"); | |
return | |
} | |
var completedValues = sheet.getRange(startRow,1,rowRange,1).getValues(); | |
var slackNames = sheet.getRange(startRow,2,rowRange,1).getValues(); | |
// Loop over the completed rows | |
for (var i = 0; i < completedValues.length; i++) { | |
var completed = completedValues[i][0]; | |
if(completed !== "" && completed == false) { | |
var name = slackNames[i][0]; | |
triggerSlackRequest("@"+name,"*You haven't completed your lunch order*, don't miss out - order now!\n" + sheetURL); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment