Created
October 17, 2016 13:58
-
-
Save tomrandle/418356428f96bccf8e690b9ea9c87c85 to your computer and use it in GitHub Desktop.
notifyOrdersAppearCompleted
This file contains hidden or 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 notifyOrdersAppearCompleted() { | |
var curHour = new Date().getHours(); | |
var notifiedCell = sheet.getRange("F3").getValues()[0][0]; | |
if (notifiedCell == true) { | |
return | |
} | |
if (curHour > 17 || curHour < 9) { | |
Logger.log("Outside work hours stopping"); | |
return | |
} | |
var values = sheet.getRange(startRow,1,rowRange,1).getValues(); | |
for (var i = 0; i < values.length; i++) { | |
var completed = values[i][0]; | |
if (completed == false) { | |
return | |
} | |
} | |
triggerSlackRequest(completedOrdersUser,"Hey, Looks like lunch orders are fully completed.\n" + sheetURL); | |
// So that adele isn't spammed every 5 minutes. | |
sheet.getRange("F3").setValue("true") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment