Include day summary
This commit is contained in:
parent
093da880ca
commit
4f0bfd4fdd
1 changed files with 17 additions and 1 deletions
|
|
@ -27,13 +27,27 @@ def fmt_row(record: dict) -> str:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def print_details(records: Iterable[dict]) -> None:
|
def print_details(records: list[dict]) -> None:
|
||||||
print("{:-^80}".format(" Details "))
|
print("{:-^80}".format(" Details "))
|
||||||
print()
|
print()
|
||||||
for record in records:
|
for record in records:
|
||||||
print(fmt_row(record))
|
print(fmt_row(record))
|
||||||
|
|
||||||
|
|
||||||
|
def print_total(records: list[dict]) -> None:
|
||||||
|
sum = timedelta(seconds=0)
|
||||||
|
for record in records:
|
||||||
|
sum += record["duration"]
|
||||||
|
|
||||||
|
total = records[-1]["end"] - records[0]["start"]
|
||||||
|
|
||||||
|
print("{:-^80}".format(" Today "))
|
||||||
|
print()
|
||||||
|
print("{:>7}: {:3.2f}".format("Total", fmt_decimal_hours(total)))
|
||||||
|
print("{:>7}: {:3.2f}".format("Working", fmt_decimal_hours(sum)))
|
||||||
|
print("{:>7}: {:3.2f}".format("Break", fmt_decimal_hours(total - sum)))
|
||||||
|
|
||||||
|
|
||||||
def print_projects(projects) -> None:
|
def print_projects(projects) -> None:
|
||||||
print("{:-^80}".format(" Projects "))
|
print("{:-^80}".format(" Projects "))
|
||||||
print()
|
print()
|
||||||
|
|
@ -92,6 +106,8 @@ def main():
|
||||||
projects[record["project"]]["duration"] += record["duration"]
|
projects[record["project"]]["duration"] += record["duration"]
|
||||||
projects[record["project"]]["tags"] += record["tags"]
|
projects[record["project"]]["tags"] += record["tags"]
|
||||||
|
|
||||||
|
print_total(input)
|
||||||
|
print()
|
||||||
print_projects(projects)
|
print_projects(projects)
|
||||||
print()
|
print()
|
||||||
print_details(input)
|
print_details(input)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue