1
0

Improved title
Some checks failed
Test Python / Test (push) Failing after 27s

This commit is contained in:
Jon Michael Aanes 2024-08-26 00:37:51 +02:00
parent 29c6723867
commit 7ab46bc48e
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA

View File

@ -15,6 +15,18 @@ ZERO_DURATION = datetime.timedelta(seconds=0)
HOUR = datetime.timedelta(hours=1)
MINUTE = datetime.timedelta(minutes=1)
def create_title(sample: RealizedWorkSample) -> str:
ls = []
for label_and_type in sample.labels:
if label_and_type.startswith(HIDDEN_LABEL_PREFIX):
continue
if label_and_type.startswith('author:'):
continue
ls.append(label_and_type)
return ' '.join(ls)
def generate_calendar(
samples: list[RealizedWorkSample],
) -> icalendar.Calendar:
@ -26,7 +38,7 @@ def generate_calendar(
for sample in samples:
title = ' '.join(sample.labels)
title = create_title(sample)
description = ''
@ -38,6 +50,10 @@ def generate_calendar(
event.add('dtstart', sample.start_at)
event.add('dtend', sample.end_at)
for label_and_type in sample.labels:
if label_and_type.startswith('author:'):
event.add('organizer', 'mailto:'+label_and_type.removeprefix('author:'))
cal.add_component(event)
del event