Compare commits
2 Commits
bccc63038b
...
0e98fe6225
Author | SHA1 | Date | |
---|---|---|---|
0e98fe6225 | |||
3e6c517fa9 |
|
@ -32,8 +32,10 @@ def fmt_year_ranges(years: list[int]) -> str:
|
||||||
def fmt_line(label: Label, total_time: datetime.timedelta) -> str:
|
def fmt_line(label: Label, total_time: datetime.timedelta) -> str:
|
||||||
hours = int(total_time / HOUR)
|
hours = int(total_time / HOUR)
|
||||||
minutes = int((total_time - hours * HOUR) / MINUTE)
|
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(
|
def generate_report(
|
||||||
samples: list[RealizedActivitySample],
|
samples: list[RealizedActivitySample],
|
||||||
|
@ -55,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:
|
||||||
|
@ -68,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')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user