5708: Confusing results with statistic gramplet and filter; fixes suggested by PeterL's patch

svn: r19414
This commit is contained in:
Doug Blank 2012-04-30 13:13:05 +00:00
parent 90d3da2e11
commit b557be86d9
3 changed files with 25 additions and 9 deletions

View File

@ -50,9 +50,10 @@ class IncompleteNames(Rule):
for name in [person.get_primary_name()] + person.get_alternate_names():
if name.get_first_name().strip() == "":
return True
for surn in name.get_surname_list():
if surn.get_surname().strip() == "":
return True
if name.get_surname_list():
for surn in name.get_surname_list():
if surn.get_surname().strip() == "":
return True
else:
return True
return False

View File

@ -103,12 +103,16 @@ class StatsGramplet(Gramplet):
with_media += 1
total_media += length
names = [person.get_primary_name()] + person.get_alternate_names()
for name in names:
if (name.get_first_name() == "" or name.get_group_name() == ""):
for name in [person.get_primary_name()] + person.get_alternate_names():
if name.get_first_name().strip() == "":
incomp_names += 1
if name.get_group_name() not in namelist:
namelist.append(name.get_group_name())
else:
if name.get_surname_list():
for surname in name.get_surname_list():
if surname.get_surname().strip() == "":
incomp_names += 1
else:
incomp_names += 1
if (not person.get_main_parents_family_handle() and
not len(person.get_family_handle_list())):

View File

@ -281,10 +281,21 @@ def run(database, document, filter_name, *args, **kwargs):
stab.columns(_("Name"), _("Birth Date"), _("Name type"))
for person in database.iter_people():
for name in [person.get_primary_name()] + person.get_alternate_names():
if name.get_group_name() == "" or name.get_first_name() == "":
if name.get_first_name().strip() == "":
stab.row([name.get_name(), "Person", person.handle], sdb.birth_or_fallback(person),
str(name.get_type()))
matches += 1
else:
if name.get_surname_list():
for surname in name.get_surname_list():
if surname.get_surname().strip() == "":
stab.row([name.get_first_name(), "Person", person.handle], sdb.birth_or_fallback(person),
str(name.get_type()))
matches += 1
else:
stab.row([name.get_first_name(), "Person", person.handle], sdb.birth_or_fallback(person),
str(name.get_type()))
matches += 1
elif (filter_name == 'people with missing birth dates'):
stab.columns(_("Person"), _("Type"))