Added a delay between grant point and deduct point

This commit is contained in:
Jacob Henry 2018-11-03 16:24:06 -04:00
parent ac11073a6d
commit 208617db2f
2 changed files with 15 additions and 5 deletions

View File

@ -1,14 +1,21 @@
import time import time
import channel_util import channel_util
msg = { roll_msg_1 = {
"type": "message", "type": "message",
"channel": channel_util.COMMAND_CENTER_ID, "channel": channel_util.SLAVES_TO_THE_MACHINE_ID,
"user": "U0Q1PKL92", "user": "U0Q1PKL92",
"text": "my name", "text": "flaked 3 rolled 2 washed 1",
"ts": "1355517523.000005" "ts": "1355517523.000005"
} }
dump_roll_msg = {
"type": "message",
"channel": channel_util.COMMAND_CENTER_ID,
"user": "U0Q1PKL92",
"text": "dump towel data",
"ts": "1355517523.000005"
}
class FakeClient(object): class FakeClient(object):
def rtm_send_message(self, channel=None, message="", thread=None, to_channel=None): def rtm_send_message(self, channel=None, message="", thread=None, to_channel=None):
@ -19,4 +26,4 @@ class FakeClient(object):
def rtm_read(self): def rtm_read(self):
time.sleep(4) time.sleep(4)
return [msg] return [dump_roll_msg]

View File

@ -4,6 +4,7 @@ import channel_util
import google_api import google_api
import slack_util import slack_util
import identifier import identifier
import time
SHEET_ID = "1lPj9GjB00BuIq9GelOWh5GmiGsheLlowPnHLnWBvMOM" SHEET_ID = "1lPj9GjB00BuIq9GelOWh5GmiGsheLlowPnHLnWBvMOM"
@ -64,6 +65,7 @@ def signoff_callback(slack, msg, match):
# Try giving the person a point # Try giving the person a point
try: try:
bro_name, bro_total = adjust_score(name, 1) bro_name, bro_total = adjust_score(name, 1)
time.sleep(1)
ass_name, ass_total = adjust_score(signer, SIGNOFF_REWARD) ass_name, ass_total = adjust_score(signer, SIGNOFF_REWARD)
slack_util.reply(slack, msg, "Gave {} one housejob point.\n" slack_util.reply(slack, msg, "Gave {} one housejob point.\n"
"They now have {} for this period.\n" "They now have {} for this period.\n"
@ -83,7 +85,8 @@ def punish_callback(slack, msg, match):
# Try giving the person a point # Try giving the person a point
try: try:
bro_name, bro_total = adjust_score(name, -1) bro_name, bro_total = adjust_score(name, -1)
ass_name, ass_total = adjust_score(signer, SIGNOFF_REWARD) time.sleep(1)
ass_name, ass_total = adjust_score(signer, -SIGNOFF_REWARD)
slack_util.reply(slack, msg, "Took one housejob point from {}.\n" slack_util.reply(slack, msg, "Took one housejob point from {}.\n"
"They now have {} for this period.\n" "They now have {} for this period.\n"
"Under the assumption that this was to undo a mistake, we have deducted the " "Under the assumption that this was to undo a mistake, we have deducted the "