Job nagging now shows house #. Disabled debug mode default

This commit is contained in:
Jacob Henry 2018-09-13 00:42:24 -04:00
parent 5443b72d71
commit 1c42f81a39
2 changed files with 13 additions and 9 deletions

View File

@ -8,8 +8,8 @@ nag_pattern = r"nagjobs (tuesday|thursday)"
SHEET_ID = "1lPj9GjB00BuIq9GelOWh5GmiGsheLlowPnHLnWBvMOM"
eight_jobs = "House Jobs!A2:C25" # Format: Job Day Bro
fiftythree_jobs = "House Jobs!E2:G6"
eight_job_range = "House Jobs!A2:C25" # Format: Job Day Bro
fiftythree_job_range = "House Jobs!E2:G6"
# For matching purposes
tuesday = "tuesday"
@ -17,8 +17,8 @@ thursday = "thursday"
class Job(object):
def __init__(self, row):
self.job_name, self.day, self.brother_name = row
def __init__(self, house, job_name, day, brother_name):
self.house, self.job_name, self.day, self.brother_name = house, job_name, day, brother_name
self.day = self.day.lower().strip()
def lookup_brother_slack_id(self):
@ -35,9 +35,13 @@ def nag_callback(slack, msg, match):
day = match.group(1).lower()
# Get the spreadsheet section
jobs = google_api.get_sheet_range(SHEET_ID, eight_jobs)
jobs = jobs + google_api.get_sheet_range(SHEET_ID, fiftythree_jobs)
jobs = [Job(r) for r in jobs]
eight_jobs = google_api.get_sheet_range(SHEET_ID, eight_job_range)
ft_jobs = google_api.get_sheet_range(SHEET_ID, fiftythree_job_range)
# Turn to job objects
eight_jobs = [Job("8", *r) for r in eight_jobs]
ft_jobs = [Job("53", *r) for r in ft_jobs]
jobs = eight_jobs + ft_jobs
# Filter to day
jobs = [j for j in jobs if j.day == day]
@ -45,7 +49,7 @@ def nag_callback(slack, msg, match):
# Nag each
response = "Do your jobs! They are as follows:\n"
for job in jobs:
response += "{} -- ".format(job.job_name)
response += "({}) {} -- ".format(job.house, job.job_name)
ids = job.lookup_brother_slack_id()
if ids:
for id in ids:

View File

@ -22,7 +22,7 @@ kill_switch = next(kill_switch_file).strip()
kill_switch_file.close()
# Enable to use dummy
DEBUG_MODE = True
DEBUG_MODE = False
def main():