0002275: A person being his own ancestor causes EOL report to crash.
svn: r10904
This commit is contained in:
parent
428919875c
commit
5c66ff1816
@ -73,9 +73,9 @@ class EndOfLineReport(Report):
|
|||||||
# values are a map whose:
|
# values are a map whose:
|
||||||
# keys are person handles
|
# keys are person handles
|
||||||
# values are an array whose:
|
# values are an array whose:
|
||||||
# elements are an array of names that link the person handle
|
# elements are an array of ancestor person handles that link
|
||||||
# to the person or interest
|
# the eol person handle to the person or interest
|
||||||
# eol_map[generation][person_handle][pedigree_index][person_name_index]
|
# eol_map[generation][person_handle][pedigree_idx][ancestor_handle_idx]
|
||||||
#
|
#
|
||||||
# There is an array of pedigrees because one person could show up twice
|
# There is an array of pedigrees because one person could show up twice
|
||||||
# in one generation (descendants marrying). Most people only have one
|
# in one generation (descendants marrying). Most people only have one
|
||||||
@ -89,39 +89,39 @@ class EndOfLineReport(Report):
|
|||||||
"""
|
"""
|
||||||
Recursively find the end of the line for each person
|
Recursively find the end of the line for each person
|
||||||
"""
|
"""
|
||||||
name = name_displayer.display(person)
|
person_handle = person.get_handle()
|
||||||
pedigree = pedigree + [name]
|
new_pedigree = list(pedigree) + [person_handle]
|
||||||
person_is_eol = False
|
person_is_eol = False
|
||||||
families = person.get_parent_family_handle_list()
|
families = person.get_parent_family_handle_list()
|
||||||
|
|
||||||
if not families:
|
if person_handle in pedigree:
|
||||||
|
# This is a severe error!
|
||||||
|
# It indicates a loop in ancestry: A -> B -> A
|
||||||
person_is_eol = True
|
person_is_eol = True
|
||||||
|
elif not families:
|
||||||
for family_handle in families:
|
person_is_eol = True
|
||||||
family = self.database.get_family_from_handle(family_handle)
|
else:
|
||||||
father_handle = family.get_father_handle()
|
for family_handle in families:
|
||||||
mother_handle = family.get_mother_handle()
|
family = self.database.get_family_from_handle(family_handle)
|
||||||
if father_handle:
|
father_handle = family.get_father_handle()
|
||||||
father = self.database.get_person_from_handle(father_handle)
|
mother_handle = family.get_mother_handle()
|
||||||
self.get_eol(father, gen+1, pedigree)
|
if father_handle:
|
||||||
if mother_handle:
|
father = self.database.get_person_from_handle(father_handle)
|
||||||
mother = self.database.get_person_from_handle(mother_handle)
|
self.get_eol(father, gen+1, new_pedigree)
|
||||||
self.get_eol(mother, gen+1, pedigree)
|
if mother_handle:
|
||||||
|
mother = self.database.get_person_from_handle(mother_handle)
|
||||||
if not father_handle or not mother_handle:
|
self.get_eol(mother, gen+1, new_pedigree)
|
||||||
person_is_eol = True
|
|
||||||
|
if not father_handle or not mother_handle:
|
||||||
|
person_is_eol = True
|
||||||
|
|
||||||
if person_is_eol:
|
if person_is_eol:
|
||||||
# This person is the end of a line
|
# This person is the end of a line
|
||||||
person_handle = person.get_handle()
|
|
||||||
if gen not in self.eol_map:
|
if gen not in self.eol_map:
|
||||||
self.eol_map[gen] = {}
|
self.eol_map[gen] = {}
|
||||||
if person_handle not in self.eol_map[gen]:
|
if person_handle not in self.eol_map[gen]:
|
||||||
self.eol_map[gen][person_handle] = []
|
self.eol_map[gen][person_handle] = []
|
||||||
self.eol_map[gen][person_handle].append( list(pedigree) )
|
self.eol_map[gen][person_handle].append( new_pedigree )
|
||||||
|
|
||||||
# Remove this person from the pedigree
|
|
||||||
pedigree = pedigree[1:len(pedigree)]
|
|
||||||
|
|
||||||
def write_report(self):
|
def write_report(self):
|
||||||
"""
|
"""
|
||||||
@ -201,7 +201,11 @@ class EndOfLineReport(Report):
|
|||||||
|
|
||||||
pedigree is an array containing the names of the people in the pedigree
|
pedigree is an array containing the names of the people in the pedigree
|
||||||
"""
|
"""
|
||||||
text = " -- ".join(pedigree)
|
names = []
|
||||||
|
for person_handle in pedigree:
|
||||||
|
person = self.database.get_person_from_handle(person_handle)
|
||||||
|
names.append(name_displayer.display(person))
|
||||||
|
text = " -- ".join(names)
|
||||||
self.doc.start_row()
|
self.doc.start_row()
|
||||||
self.doc.start_cell('EOL-TableCell')
|
self.doc.start_cell('EOL-TableCell')
|
||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
|
Loading…
Reference in New Issue
Block a user