From 208617db2f913ac924c7111c2d8f91329be867f8 Mon Sep 17 00:00:00 2001 From: Jacob Henry Date: Sat, 3 Nov 2018 16:24:06 -0400 Subject: [PATCH] Added a delay between grant point and deduct point --- dummy.py | 15 +++++++++++---- job_signoff.py | 5 ++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/dummy.py b/dummy.py index e570d3a..15450c6 100644 --- a/dummy.py +++ b/dummy.py @@ -1,14 +1,21 @@ import time import channel_util -msg = { +roll_msg_1 = { "type": "message", - "channel": channel_util.COMMAND_CENTER_ID, + "channel": channel_util.SLAVES_TO_THE_MACHINE_ID, "user": "U0Q1PKL92", - "text": "my name", + "text": "flaked 3 rolled 2 washed 1", "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): def rtm_send_message(self, channel=None, message="", thread=None, to_channel=None): @@ -19,4 +26,4 @@ class FakeClient(object): def rtm_read(self): time.sleep(4) - return [msg] + return [dump_roll_msg] diff --git a/job_signoff.py b/job_signoff.py index f6a0dea..e499bff 100644 --- a/job_signoff.py +++ b/job_signoff.py @@ -4,6 +4,7 @@ import channel_util import google_api import slack_util import identifier +import time SHEET_ID = "1lPj9GjB00BuIq9GelOWh5GmiGsheLlowPnHLnWBvMOM" @@ -64,6 +65,7 @@ def signoff_callback(slack, msg, match): # Try giving the person a point try: bro_name, bro_total = adjust_score(name, 1) + time.sleep(1) ass_name, ass_total = adjust_score(signer, SIGNOFF_REWARD) slack_util.reply(slack, msg, "Gave {} one housejob point.\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: 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" "They now have {} for this period.\n" "Under the assumption that this was to undo a mistake, we have deducted the "