chore: attempt to fix #1, but instead made it fail the same way with completely different logic
This commit is contained in:
parent
061f263eb4
commit
1c50050a05
1 changed files with 12 additions and 12 deletions
|
@ -5,6 +5,8 @@ import json
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from dateutil.relativedelta import relativedelta, MO
|
from dateutil.relativedelta import relativedelta, MO
|
||||||
import click
|
import click
|
||||||
|
import itertools
|
||||||
|
import operator
|
||||||
|
|
||||||
__version__ = "0.2.0"
|
__version__ = "0.2.0"
|
||||||
|
|
||||||
|
@ -32,20 +34,18 @@ def main(uuid, header):
|
||||||
)
|
)
|
||||||
|
|
||||||
entries = json.loads(tasks.stdout.decode())
|
entries = json.loads(tasks.stdout.decode())
|
||||||
last_project = ""
|
output_list = []
|
||||||
if header:
|
if header:
|
||||||
print(f"Reporting from: {last_monday}")
|
print(f"Reporting from: {last_monday}")
|
||||||
for entry in entries:
|
for i, g in itertools.groupby(entries, key=operator.itemgetter("project")):
|
||||||
try:
|
output_list.append(list(g))
|
||||||
if entry["project"] != last_project:
|
for project in output_list:
|
||||||
last_project = entry["project"]
|
print(f'* {project[0]["project"]}')
|
||||||
except KeyError:
|
for entry in project:
|
||||||
entry["project"] = ""
|
if uuid:
|
||||||
print(f"* {entry['project']}")
|
print(f'\t* {entry["description"]} ({entry["uuid"]})')
|
||||||
if uuid:
|
else:
|
||||||
print(f"\t* {entry['description']} ({entry['uuid']})")
|
print(f'\t* {entry["description"]}')
|
||||||
else:
|
|
||||||
print(f"\t* {entry['description']}")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue