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,6 +50,7 @@ class IncompleteNames(Rule):
for name in [person.get_primary_name()] + person.get_alternate_names(): for name in [person.get_primary_name()] + person.get_alternate_names():
if name.get_first_name().strip() == "": if name.get_first_name().strip() == "":
return True return True
if name.get_surname_list():
for surn in name.get_surname_list(): for surn in name.get_surname_list():
if surn.get_surname().strip() == "": if surn.get_surname().strip() == "":
return True return True

View File

@ -103,12 +103,16 @@ class StatsGramplet(Gramplet):
with_media += 1 with_media += 1
total_media += length total_media += length
names = [person.get_primary_name()] + person.get_alternate_names() for name in [person.get_primary_name()] + person.get_alternate_names():
for name in names: if name.get_first_name().strip() == "":
if (name.get_first_name() == "" or name.get_group_name() == ""): incomp_names += 1
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 incomp_names += 1
if name.get_group_name() not in namelist:
namelist.append(name.get_group_name())
if (not person.get_main_parents_family_handle() and if (not person.get_main_parents_family_handle() and
not len(person.get_family_handle_list())): 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")) stab.columns(_("Name"), _("Birth Date"), _("Name type"))
for person in database.iter_people(): for person in database.iter_people():
for name in [person.get_primary_name()] + person.get_alternate_names(): 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), stab.row([name.get_name(), "Person", person.handle], sdb.birth_or_fallback(person),
str(name.get_type())) str(name.get_type()))
matches += 1 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'): elif (filter_name == 'people with missing birth dates'):
stab.columns(_("Person"), _("Type")) stab.columns(_("Person"), _("Type"))