Fix connection lines for marriage events

- Update _get_events_for_person to include events where person is involved
- For marriage events, both spouses now have connection lines to the marriage event
- Uses _get_all_persons_for_event to check if person is involved in multi-person events
This commit is contained in:
Daniel Viegas 2025-11-30 16:46:01 +01:00
parent 137de07052
commit c9054752fd

View File

@ -2590,6 +2590,7 @@ class MyTimelineView(NavigationView):
def _get_events_for_person(self, person_handle: str, events_list: List['TimelineEvent']) -> List['TimelineEvent']:
"""
Filter events list to only include events for a specific person.
For marriage events, includes the event if the person is one of the spouses.
Args:
person_handle: The handle of the person to filter events for.
@ -2598,10 +2599,21 @@ class MyTimelineView(NavigationView):
Returns:
List[TimelineEvent]: Filtered list of events for the specified person.
"""
return [
event for event in events_list
if self._person_matches_handle(event.person, person_handle)
]
person_events = []
for event in events_list:
# Check if event.person matches directly
if self._person_matches_handle(event.person, person_handle):
person_events.append(event)
else:
# For events that don't directly match, check if person is involved
# (e.g., marriage events where person is the other spouse)
all_persons = self._get_all_persons_for_event(event.event, event)
for person in all_persons:
if person.get_handle() == person_handle:
person_events.append(event)
break
return person_events
def _get_event_type_display_name(self, event_type: EventType) -> str:
"""