fix: Added handling for empty/no project name

This commit is contained in:
Alex Kelly 2021-08-20 09:24:54 -04:00
parent 7a36290b40
commit a835378a86

View file

@ -18,14 +18,15 @@ def main(uuid, header):
today = date.today() today = date.today()
last_monday = today + relativedelta(weekday=MO(-2)) last_monday = today + relativedelta(weekday=MO(-2))
tasks = subprocess.run( task_command = [
[
"task", "task",
f"end.after:{last_monday}", f"end.after:{last_monday}",
"export", "export",
"-home",
"status_report:display", "status_report:display",
], "-home",
]
tasks = subprocess.run(
task_command,
capture_output=True, capture_output=True,
check=True, check=True,
) )
@ -35,8 +36,11 @@ def main(uuid, header):
if header: if header:
print(f"Reporting from: {last_monday}") print(f"Reporting from: {last_monday}")
for entry in entries: for entry in entries:
try:
if entry["project"] != last_project: if entry["project"] != last_project:
last_project = entry["project"] last_project = entry["project"]
except KeyError:
entry["project"] = ""
print(f"* {entry['project']}") print(f"* {entry['project']}")
if uuid: if uuid:
print(f"\t* {entry['description']} ({entry['uuid']})") print(f"\t* {entry['description']} ({entry['uuid']})")