Ignore invalid rows

This commit is contained in:
Jacob Henry 2018-11-01 11:23:46 -04:00
parent a4467d8bfc
commit 71786ca13d
1 changed files with 8 additions and 2 deletions

View File

@ -30,8 +30,14 @@ def nag_callback(slack, msg, match):
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]
def valid_row(x):
try:
return len(x) == 2
except (AttributeError, TypeError):
return False
eight_jobs = [Job("8", *r) for r in eight_jobs if valid_row(r)]
ft_jobs = [Job("53", *r) for r in ft_jobs if valid_row(r)]
jobs = eight_jobs + ft_jobs
# Filter to day