Merge pull request #1 from cnovel/fix_so

Fix find SO
This commit is contained in:
Cyril 2024-01-29 11:02:21 +01:00 committed by GitHub
commit fcdfe6c6a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -144,10 +144,10 @@ def load_mariage_to_list(mariages_file: str) -> list:
def find_significant_other(mariages: list, uid: int) -> (int, str): def find_significant_other(mariages: list, uid: int) -> (int, str):
for m in mariages: matches = sorted([m for m in mariages if m.in_this_union(uid)], key=lambda union: union.event_date())
if m.in_this_union(uid): if not matches:
return m.get_so(uid), m.union()
return -1, '' return -1, ''
return matches[-1].get_so(uid), matches[-1].union()
def create_events_from_span(start: date, end: date, id_to_person: dict, mariages: list) -> list: def create_events_from_span(start: date, end: date, id_to_person: dict, mariages: list) -> list: