Fix for correct unique surname statistics.
svn: r20686
This commit is contained in:
parent
ace8790379
commit
ee2f5a990d
@ -104,6 +104,12 @@ class StatsGramplet(Gramplet):
|
|||||||
total_media += length
|
total_media += length
|
||||||
|
|
||||||
for name in [person.get_primary_name()] + person.get_alternate_names():
|
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() == "":
|
if name.get_first_name().strip() == "":
|
||||||
incomp_names += 1
|
incomp_names += 1
|
||||||
else:
|
else:
|
||||||
|
@ -92,6 +92,7 @@ class SurnameCloudGramplet(Gramplet):
|
|||||||
representative_handle = {}
|
representative_handle = {}
|
||||||
|
|
||||||
cnt = 0
|
cnt = 0
|
||||||
|
namelist =[]
|
||||||
for person in self.dbstate.db.iter_people():
|
for person in self.dbstate.db.iter_people():
|
||||||
allnames = [person.get_primary_name()] + person.get_alternate_names()
|
allnames = [person.get_primary_name()] + person.get_alternate_names()
|
||||||
allnames = set([name.get_group_name().strip() for name in allnames])
|
allnames = set([name.get_group_name().strip() for name in allnames])
|
||||||
@ -101,6 +102,11 @@ class SurnameCloudGramplet(Gramplet):
|
|||||||
cnt += 1
|
cnt += 1
|
||||||
if not cnt % _YIELD_INTERVAL:
|
if not cnt % _YIELD_INTERVAL:
|
||||||
yield True
|
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
|
total_people = cnt
|
||||||
surname_sort = []
|
surname_sort = []
|
||||||
@ -112,7 +118,6 @@ class SurnameCloudGramplet(Gramplet):
|
|||||||
if not cnt % _YIELD_INTERVAL:
|
if not cnt % _YIELD_INTERVAL:
|
||||||
yield True
|
yield True
|
||||||
|
|
||||||
total_surnames = cnt
|
|
||||||
surname_sort.sort(reverse=True)
|
surname_sort.sort(reverse=True)
|
||||||
cloud_names = []
|
cloud_names = []
|
||||||
cloud_values = []
|
cloud_values = []
|
||||||
@ -165,7 +170,7 @@ class SurnameCloudGramplet(Gramplet):
|
|||||||
self.append_text(("\n\n" + _("Total unique surnames") + ": %d\n") %
|
self.append_text(("\n\n" + _("Total unique surnames") + ": %d\n") %
|
||||||
total_surnames)
|
total_surnames)
|
||||||
self.append_text((_("Total surnames showing") + ": %d\n") % showing)
|
self.append_text((_("Total surnames showing") + ": %d\n") % showing)
|
||||||
self.append_text((_("Total people") + ": %d") % total_people, "begin")
|
self.append_text((_("Total people") + ": %d") % len(namelist), "begin")
|
||||||
|
|
||||||
def build_options(self):
|
def build_options(self):
|
||||||
from gramps.gen.plug.menu import NumberOption
|
from gramps.gen.plug.menu import NumberOption
|
||||||
|
@ -147,8 +147,10 @@ class SummaryReport(Report):
|
|||||||
unknowns += 1
|
unknowns += 1
|
||||||
|
|
||||||
# Count unique surnames
|
# Count unique surnames
|
||||||
if name.get_surname() not in namelist:
|
for name in [person.get_primary_name()] + person.get_alternate_names():
|
||||||
namelist.append(name.get_surname())
|
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.start_paragraph("SR-Normal")
|
||||||
self.doc.write_text(_("Number of individuals: %d") % num_people)
|
self.doc.write_text(_("Number of individuals: %d") % num_people)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user