Skip to content

Commit

Permalink
Deduplicate person timeline events. (#1133)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartfeenstra authored Jan 5, 2024
1 parent c554560 commit 76d228c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions betty/extension/cotton_candy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,15 @@ def _is_person_timeline_presence(presence: Presence) -> bool:


def person_timeline_events(person: Person, lifetime_threshold: int) -> Iterable[Event]:
seen = []
for event in _person_timeline_events(person, lifetime_threshold):
if event in seen:
continue
seen.append(event)
yield event


def _person_timeline_events(person: Person, lifetime_threshold: int) -> Iterable[Event]:
# Collect all associated events for a person.
# Start with the person's own events for which their presence is public.
for presence in person.presences:
Expand Down

0 comments on commit 76d228c

Please sign in to comment.