From 94f108807f4e8f4ccf5e75426d68ea9c76b2c7e4 Mon Sep 17 00:00:00 2001 From: Peter Landgren Date: Tue, 20 Nov 2012 18:17:22 +0000 Subject: [PATCH] Issue 6188. Number of unique surnames are now correct in both StatsGramplet and SurnameCloudgramplet. svn: r20683 --- src/plugins/gramplet/StatsGramplet.py | 7 ++++++- src/plugins/gramplet/SurnameCloudGramplet.py | 9 +++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/plugins/gramplet/StatsGramplet.py b/src/plugins/gramplet/StatsGramplet.py index cdd30239d..572ec47c2 100644 --- a/src/plugins/gramplet/StatsGramplet.py +++ b/src/plugins/gramplet/StatsGramplet.py @@ -106,14 +106,19 @@ class StatsGramplet(Gramplet): for name in [person.get_primary_name()] + person.get_alternate_names(): 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 - + if (not person.get_main_parents_family_handle() and not len(person.get_family_handle_list())): disconnected += 1 diff --git a/src/plugins/gramplet/SurnameCloudGramplet.py b/src/plugins/gramplet/SurnameCloudGramplet.py index a50262d22..c37d165ee 100644 --- a/src/plugins/gramplet/SurnameCloudGramplet.py +++ b/src/plugins/gramplet/SurnameCloudGramplet.py @@ -106,12 +106,13 @@ class SurnameCloudGramplet(Gramplet): surname_sort = [] total = cnt = 0 for surname in surnames: - surname_sort.append( (surnames[surname], surname) ) - total += surnames[surname] - cnt += 1 + if not surname.strip() == "": + surname_sort.append( (surnames[surname], surname) ) + total += surnames[surname] + cnt += 1 if not cnt % _YIELD_INTERVAL: yield True - + total_surnames = cnt surname_sort.sort(reverse=True) cloud_names = []