1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# event_type_handler.py
from datetime import datetime
from typing import List, Dict, Tuple
from calendar_entry import CalendarEntry
from config import EventConfig
from date_service import DateService
class EventTypeHandler:
"""Handles event type-specific business rules and categorization"""
@staticmethod
def get_duration_for_type(event_type: str, start_date: datetime) -> datetime:
"""Calculate end date for event type based on business rules"""
if event_type == "EZ pauschal":
return start_date + EventConfig.get_ez_pauschal_duration()
else:
# For other types, duration is determined by user input
return start_date
@staticmethod
def categorize_events(entries: List[CalendarEntry]) -> Dict[str, List[Tuple[datetime, datetime, str]]]:
"""Categorize calendar entries by type for processing"""
categorized = {}
for entry in entries:
if entry.keyword not in categorized:
categorized[entry.keyword] = []
categorized[entry.keyword].append((
entry.start_date,
entry.end_date,
entry.id
))
return categorized
@staticmethod
def validate_event_type(event_type: str) -> bool:
"""Validate that event type is supported"""
return EventConfig.is_valid_keyword(event_type)
@staticmethod
def get_event_type_display_name(event_type: str) -> str:
"""Get display name for event type"""
return event_type
@staticmethod
def calculate_accounted_time(entry: CalendarEntry) -> str:
"""Deprecated: accounted time is computed and stored elsewhere."""
return ""
@staticmethod
def should_hide_end_date_input(event_type: str) -> bool:
"""Determine if end date input should be hidden for this event type"""
return event_type == "EZ pauschal"
@staticmethod
def get_event_type_description(event_type: str) -> str:
"""Deprecated: display descriptions removed for lean runtime."""
return ""
@staticmethod
def get_processing_order() -> List[str]:
"""Deprecated: processing order is defined inline where needed."""
return ["EZ 100%", "EZ 50%", "EZ pauschal", "Sonstige"]
@staticmethod
def is_full_time_event(event_type: str) -> bool:
"""Deprecated helper kept for compatibility."""
return event_type in ["EZ 100%", "EZ pauschal"]
@staticmethod
def is_part_time_event(event_type: str) -> bool:
"""Deprecated helper kept for compatibility."""
return event_type == "EZ 50%"
@staticmethod
def is_other_event(event_type: str) -> bool:
"""Deprecated helper kept for compatibility."""
return event_type == "Sonstige"
|