8621: Recursion Filter error

This commit is contained in:
Doug Blank 2015-06-06 19:56:34 -04:00
parent abf785be5e
commit 2f0496d0a3

View File

@ -78,22 +78,26 @@ class IsDescendantFamilyOf(Rule):
return
# Add self
self.matches.add(person.handle)
expand = [person]
for family_handle in person.get_family_handle_list():
family = self.db.get_family_from_handle(family_handle)
if family:
# Add every child recursively
for child_ref in family.get_child_ref_list():
if child_ref:
self.add_matches(self.db.get_person_from_handle(child_ref.ref))
# Add spouse
if person.handle == family.get_father_handle():
spouse_handle = family.get_mother_handle()
else:
spouse_handle = family.get_father_handle()
self.matches.add(spouse_handle)
while expand:
person = expand.pop(0)
if person is None:
continue
self.matches.add(person.handle)
for family_handle in person.get_family_handle_list():
family = self.db.get_family_from_handle(family_handle)
if family:
# Add every child recursively
for child_ref in family.get_child_ref_list():
if child_ref:
expand.append(self.db.get_person_from_handle(child_ref.ref))
# Add spouse
if person.handle == family.get_father_handle():
spouse_handle = family.get_mother_handle()
else:
spouse_handle = family.get_father_handle()
self.matches.add(spouse_handle)
def exclude(self):
# This removes root person and his/her spouses from the matches set