Füge Option zum Ausschließen von Ruhepausen hinzu
- Neue Exportoption "Ruhepausen ausschließen - Ruhe" in GUI - Parameter exclude_rest in create_ics_from_dienstplan() hinzugefügt - Filtert Events mit dem finalen Titel "Ruhe" (R56, R36, vRWF48, RWE, vR48) - Einstellung wird in Konfiguration gespeichert und beim nächsten Start wiederhergestellt
This commit is contained in:
@@ -154,9 +154,14 @@ def parse_dienstplan_table(table, month_start_str):
|
||||
return events
|
||||
|
||||
|
||||
def create_ics_from_dienstplan(dienstplan, output_path=None):
|
||||
def create_ics_from_dienstplan(dienstplan, output_path=None, exclude_rest=False):
|
||||
"""
|
||||
Erstellt eine ICS-Datei aus den Dienstplan-Daten
|
||||
|
||||
Args:
|
||||
dienstplan: Dictionary mit Dienstplan-Daten
|
||||
output_path: Pfad für Output-Datei
|
||||
exclude_rest: Wenn True, werden Ruhepausen nicht exportiert
|
||||
"""
|
||||
# Erstelle Calendar
|
||||
cal = Calendar()
|
||||
@@ -168,16 +173,30 @@ def create_ics_from_dienstplan(dienstplan, output_path=None):
|
||||
# Timezone
|
||||
tz = pytz.timezone('Europe/Berlin')
|
||||
|
||||
# Service-Typen die als "Ruhe" angezeigt werden
|
||||
rest_types = ['R56', 'R36', 'vRWF48', 'RWE', 'vR48']
|
||||
|
||||
# Füge Events hinzu
|
||||
for event_data in dienstplan['events']:
|
||||
if not event_data['service']:
|
||||
continue
|
||||
|
||||
service_type = event_data['service']
|
||||
|
||||
event = Event()
|
||||
|
||||
# Titel - nur den Dienstart
|
||||
service_type = event_data['service']
|
||||
title = f"Dienst: {service_type}"
|
||||
# Spezielle Service-Typen mit aussagekräftigen Namen
|
||||
if service_type == '0060':
|
||||
title = "Urlaub"
|
||||
elif service_type in rest_types:
|
||||
title = "Ruhe"
|
||||
else:
|
||||
title = service_type
|
||||
|
||||
# Überspringe Ruhepausen wenn gewünscht (nach Titel-Erstellung)
|
||||
if exclude_rest and title == "Ruhe":
|
||||
continue
|
||||
|
||||
event.add('summary', title)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user