Fix Relationship Graph for extraneous families when using filter (#576)
Fixes #10492
This commit is contained in:
parent
8c1a244b1e
commit
a668f0d04f
@ -194,6 +194,8 @@ class RelGraphReport(Report):
|
|||||||
person_handles = self._filter.apply(self._db,
|
person_handles = self._filter.apply(self._db,
|
||||||
self._db.iter_person_handles(),
|
self._db.iter_person_handles(),
|
||||||
user=self._user)
|
user=self._user)
|
||||||
|
# Hash people in a dictionary for faster inclusion checking
|
||||||
|
self.persons = set(person_handles)
|
||||||
|
|
||||||
person_handles = self.sort_persons(person_handles)
|
person_handles = self.sort_persons(person_handles)
|
||||||
|
|
||||||
@ -216,7 +218,7 @@ class RelGraphReport(Report):
|
|||||||
person = self.database.get_person_from_handle(person_handle)
|
person = self.database.get_person_from_handle(person_handle)
|
||||||
has_parent = False
|
has_parent = False
|
||||||
for parent_handle in find_parents(self.database, person):
|
for parent_handle in find_parents(self.database, person):
|
||||||
if parent_handle not in person_handle_list:
|
if parent_handle not in self.persons:
|
||||||
continue
|
continue
|
||||||
has_parent = True
|
has_parent = True
|
||||||
if not has_parent:
|
if not has_parent:
|
||||||
@ -233,7 +235,7 @@ class RelGraphReport(Report):
|
|||||||
cur = todolist.pop(0)
|
cur = todolist.pop(0)
|
||||||
if cur in p_done:
|
if cur in p_done:
|
||||||
continue
|
continue
|
||||||
if cur not in person_handle_list:
|
if cur not in self.persons:
|
||||||
p_done.add(cur)
|
p_done.add(cur)
|
||||||
continue
|
continue
|
||||||
person = self.database.get_person_from_handle(cur)
|
person = self.database.get_person_from_handle(cur)
|
||||||
@ -243,7 +245,7 @@ class RelGraphReport(Report):
|
|||||||
for parent_handle in find_parents(self.database, person):
|
for parent_handle in find_parents(self.database, person):
|
||||||
if not parent_handle or parent_handle in p_done:
|
if not parent_handle or parent_handle in p_done:
|
||||||
continue
|
continue
|
||||||
if parent_handle not in person_handle_list:
|
if parent_handle not in self.persons:
|
||||||
continue
|
continue
|
||||||
todolist.insert(0, parent_handle)
|
todolist.insert(0, parent_handle)
|
||||||
missing_parents = True
|
missing_parents = True
|
||||||
@ -280,9 +282,6 @@ class RelGraphReport(Report):
|
|||||||
returns string of Graphviz edges linking parents to families or
|
returns string of Graphviz edges linking parents to families or
|
||||||
children
|
children
|
||||||
"""
|
"""
|
||||||
# Hash people in a dictionary for faster inclusion checking
|
|
||||||
person_dict = dict([handle, 1] for handle in person_handles)
|
|
||||||
|
|
||||||
for person_handle in person_handles:
|
for person_handle in person_handles:
|
||||||
if self._user:
|
if self._user:
|
||||||
self._user.step_progress()
|
self._user.step_progress()
|
||||||
@ -297,19 +296,19 @@ class RelGraphReport(Report):
|
|||||||
if child_ref.ref == person_handle:
|
if child_ref.ref == person_handle:
|
||||||
frel = child_ref.frel
|
frel = child_ref.frel
|
||||||
mrel = child_ref.mrel
|
mrel = child_ref.mrel
|
||||||
elif child_ref.ref in person_dict:
|
elif child_ref.ref in self.persons:
|
||||||
sibling = True
|
sibling = True
|
||||||
if (self.show_families and
|
if (self.show_families and
|
||||||
((father_handle and father_handle in person_dict) or
|
((father_handle and father_handle in self.persons) or
|
||||||
(mother_handle and mother_handle in person_dict) or
|
(mother_handle and mother_handle in self.persons) or
|
||||||
sibling)):
|
sibling)):
|
||||||
# Link to the family node if either parent is in graph
|
# Link to the family node if either parent is in graph
|
||||||
self.add_family_link(p_id, family, frel, mrel)
|
self.add_family_link(p_id, family, frel, mrel)
|
||||||
else:
|
else:
|
||||||
# Link to the parents' nodes directly, if they are in graph
|
# Link to the parents' nodes directly, if they are in graph
|
||||||
if father_handle and father_handle in person_dict:
|
if father_handle and father_handle in self.persons:
|
||||||
self.add_parent_link(p_id, father_handle, frel)
|
self.add_parent_link(p_id, father_handle, frel)
|
||||||
if mother_handle and mother_handle in person_dict:
|
if mother_handle and mother_handle in self.persons:
|
||||||
self.add_parent_link(p_id, mother_handle, mrel)
|
self.add_parent_link(p_id, mother_handle, mrel)
|
||||||
|
|
||||||
def add_family_link(self, p_id, family, frel, mrel):
|
def add_family_link(self, p_id, family, frel, mrel):
|
||||||
@ -395,7 +394,8 @@ class RelGraphReport(Report):
|
|||||||
if family is None:
|
if family is None:
|
||||||
continue
|
continue
|
||||||
for child_ref in family.get_child_ref_list():
|
for child_ref in family.get_child_ref_list():
|
||||||
if child_ref.ref != person_handle:
|
if (child_ref.ref != person_handle and
|
||||||
|
child_ref.ref in self.persons):
|
||||||
families_done.add(fam_handle)
|
families_done.add(fam_handle)
|
||||||
self.__add_family(fam_handle)
|
self.__add_family(fam_handle)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user