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

svn: r19415
This commit is contained in:
Doug Blank
2012-04-30 13:21:21 +00:00
parent b557be86d9
commit 5bfe83b19f
3 changed files with 17 additions and 10 deletions

View File

@ -152,8 +152,8 @@ class StatsGramplet(Gramplet):
'Filter', 'people with unknown gender') 'Filter', 'people with unknown gender')
self.append_text(" %s" % unknowns) self.append_text(" %s" % unknowns)
self.append_text("\n") self.append_text("\n")
self.link("%s:" % _("Individuals with incomplete names"), self.link("%s:" % _("Incomplete names"),
'Filter', 'people with incomplete names') 'Filter', 'incomplete names')
self.append_text(" %s" % incomp_names) self.append_text(" %s" % incomp_names)
self.append_text("\n") self.append_text("\n")
self.link("%s:" % _("Individuals missing birth dates"), self.link("%s:" % _("Individuals missing birth dates"),

View File

@ -59,8 +59,8 @@ fname_map = {'all': _('Filtering_on|all'),
'females': _('Filtering_on|females'), 'females': _('Filtering_on|females'),
'people with unknown gender': 'people with unknown gender':
_('Filtering_on|people with unknown gender'), _('Filtering_on|people with unknown gender'),
'people with incomplete names': 'incomplete names':
_('Filtering_on|people with incomplete names'), _('Filtering_on|incomplete names'),
'people with missing birth dates': 'people with missing birth dates':
_('Filtering_on|people with missing birth dates'), _('Filtering_on|people with missing birth dates'),
'disconnected people': _('Filtering_on|disconnected people'), 'disconnected people': _('Filtering_on|disconnected people'),
@ -277,7 +277,7 @@ def run(database, document, filter_name, *args, **kwargs):
str(person.get_primary_name().get_type())) str(person.get_primary_name().get_type()))
matches += 1 matches += 1
elif (filter_name == 'people with incomplete names'): elif (filter_name == 'incomplete names'):
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():

View File

@ -113,8 +113,15 @@ class SummaryReport(Report):
with_media += 1 with_media += 1
# Count people with incomplete names. # Count people with incomplete names.
name = person.get_primary_name() for name in [person.get_primary_name()] + person.get_alternate_names():
if name.get_first_name() == "" or name.get_surname() == "": if name.get_first_name().strip() == "":
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
# Count people without families. # Count people without families.
@ -160,7 +167,7 @@ class SummaryReport(Report):
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.start_paragraph("SR-Normal") self.doc.start_paragraph("SR-Normal")
self.doc.write_text(_("Individuals with incomplete names: %d") % self.doc.write_text(_("Incomplete names: %d") %
incomp_names) incomp_names)
self.doc.end_paragraph() self.doc.end_paragraph()