1
0

Auto line length
All checks were successful
Run Python tests (through Pytest) / Test (push) Successful in 35s
Verify Python project can be installed, loaded and have version checked / Test (push) Successful in 37s

This commit is contained in:
Jon Michael Aanes 2025-03-01 23:20:13 +01:00
parent 3e6c517fa9
commit 0e98fe6225

View File

@ -35,6 +35,7 @@ def fmt_line(label: Label, total_time: datetime.timedelta) -> str:
label_str = str(label.label) label_str = str(label.label)
return f' {label.category:20} {label_str:50} {hours:-4d}h {minutes:-2d}m' return f' {label.category:20} {label_str:50} {hours:-4d}h {minutes:-2d}m'
LINE_LENGTH = len(fmt_line(Label('',''), datetime.timedelta()))
def generate_report( def generate_report(
samples: list[RealizedActivitySample], samples: list[RealizedActivitySample],
@ -56,7 +57,7 @@ def generate_report(
time_and_label.sort(reverse=True) time_and_label.sort(reverse=True)
# #
yield '-' * 66 yield '-' * LINE_LENGTH
yield '\n' yield '\n'
for total_time, label in time_and_label: for total_time, label in time_and_label:
if label.category == HIDDEN_LABEL_CATEGORY: if label.category == HIDDEN_LABEL_CATEGORY:
@ -69,7 +70,7 @@ def generate_report(
yield '\n' yield '\n'
del label, total_time del label, total_time
yield '-' * 66 yield '-' * LINE_LENGTH
yield '\n' yield '\n'
label_total = Label(HIDDEN_LABEL_CATEGORY, 'total') label_total = Label(HIDDEN_LABEL_CATEGORY, 'total')