1
0

Compare commits

..

2 Commits

Author SHA1 Message Date
0e98fe6225 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
2025-03-01 23:20:16 +01:00
3e6c517fa9 Fixed labels 2025-03-01 23:18:52 +01:00

View File

@ -32,8 +32,10 @@ def fmt_year_ranges(years: list[int]) -> str:
def fmt_line(label: Label, total_time: datetime.timedelta) -> str:
hours = int(total_time / HOUR)
minutes = int((total_time - hours * HOUR) / MINUTE)
return f' {label.category:10} {label.label:40} {hours:-4d}h {minutes:-2d}m'
label_str = str(label.label)
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(
samples: list[RealizedActivitySample],
@ -55,7 +57,7 @@ def generate_report(
time_and_label.sort(reverse=True)
#
yield '-' * 66
yield '-' * LINE_LENGTH
yield '\n'
for total_time, label in time_and_label:
if label.category == HIDDEN_LABEL_CATEGORY:
@ -68,7 +70,7 @@ def generate_report(
yield '\n'
del label, total_time
yield '-' * 66
yield '-' * LINE_LENGTH
yield '\n'
label_total = Label(HIDDEN_LABEL_CATEGORY, 'total')