diff --git a/src/plugins/gramplet/StatsGramplet.py b/src/plugins/gramplet/StatsGramplet.py index 572ec47c2..99bc340e0 100644 --- a/src/plugins/gramplet/StatsGramplet.py +++ b/src/plugins/gramplet/StatsGramplet.py @@ -104,18 +104,19 @@ class StatsGramplet(Gramplet): total_media += length for name in [person.get_primary_name()] + person.get_alternate_names(): + + # Count unique surnames + if not name.get_surname().strip() in namelist \ + and not name.get_surname().strip() == "": + namelist.append(name.get_surname().strip()) + if name.get_first_name().strip() == "": incomp_names += 1 - if not name.get_surname().strip() in namelist: - namelist.append(name.get_surname().strip()) else: if name.get_surname_list(): for surname in name.get_surname_list(): if surname.get_surname().strip() == "": incomp_names += 1 - else: - if not surname.get_surname().strip() in namelist: - namelist.append(surname.get_surname().strip()) else: incomp_names += 1 diff --git a/src/plugins/gramplet/SurnameCloudGramplet.py b/src/plugins/gramplet/SurnameCloudGramplet.py index c37d165ee..57ee18259 100644 --- a/src/plugins/gramplet/SurnameCloudGramplet.py +++ b/src/plugins/gramplet/SurnameCloudGramplet.py @@ -92,6 +92,7 @@ class SurnameCloudGramplet(Gramplet): representative_handle = {} cnt = 0 + namelist =[] for person in self.dbstate.db.iter_people(): allnames = [person.get_primary_name()] + person.get_alternate_names() allnames = set([name.get_group_name().strip() for name in allnames]) @@ -101,6 +102,11 @@ class SurnameCloudGramplet(Gramplet): cnt += 1 if not cnt % _YIELD_INTERVAL: yield True + # Count unique surnames + for name in [person.get_primary_name()] + person.get_alternate_names(): + if not name.get_surname().strip() in namelist \ + and not name.get_surname().strip() == "": + namelist.append(name.get_surname().strip()) total_people = cnt surname_sort = [] @@ -112,8 +118,7 @@ class SurnameCloudGramplet(Gramplet): cnt += 1 if not cnt % _YIELD_INTERVAL: yield True - - total_surnames = cnt + surname_sort.sort(reverse=True) cloud_names = [] cloud_values = [] @@ -164,7 +169,7 @@ class SurnameCloudGramplet(Gramplet): self.append_text(" ") showing += 1 self.append_text(("\n\n" + _("Total unique surnames") + ": %d\n") % - total_surnames) + len(namelist)) self.append_text((_("Total surnames showing") + ": %d\n") % showing) self.append_text((_("Total people") + ": %d") % total_people, "begin") diff --git a/src/plugins/textreport/Summary.py b/src/plugins/textreport/Summary.py index fd8640118..791fb0536 100644 --- a/src/plugins/textreport/Summary.py +++ b/src/plugins/textreport/Summary.py @@ -140,8 +140,10 @@ class SummaryReport(Report): unknowns += 1 # Count unique surnames - if name.get_surname() not in namelist: - namelist.append(name.get_surname()) + for name in [person.get_primary_name()] + person.get_alternate_names(): + if not name.get_surname().strip() in namelist \ + and not name.get_surname().strip() == "": + namelist.append(name.get_surname().strip()) self.doc.start_paragraph("SR-Normal") self.doc.write_text(_("Number of individuals: %d") % num_people)