AgeOnDate: backported changes that show reasoning for dead/alive status and age estimate
svn: r23157
This commit is contained in:
parent
31a967173d
commit
03e800d808
@ -52,20 +52,34 @@ def run(database, document, date):
|
|||||||
else:
|
else:
|
||||||
sdoc.title(_("People probably alive and their ages on %s") %
|
sdoc.title(_("People probably alive and their ages on %s") %
|
||||||
DateHandler.displayer.display(date))
|
DateHandler.displayer.display(date))
|
||||||
stab.columns(_("Person"), _("Age")) # Actual Date makes column unicode
|
stab.columns(_("Person"), _("Age"), _("Status")) # Actual Date makes column unicode
|
||||||
matches = 0
|
alive_matches = 0
|
||||||
|
dead_matches = 0
|
||||||
for person in sdb.all_people():
|
for person in sdb.all_people():
|
||||||
alive, birth, death, explain, relative = \
|
alive, birth, death, explain, relative = \
|
||||||
probably_alive(person, database, date, return_range=True)
|
probably_alive(person, database, date, return_range=True)
|
||||||
# Doesn't show people probably alive but no way of figuring an age:
|
# Doesn't show people probably alive but no way of figuring an age:
|
||||||
if alive and birth:
|
if alive:
|
||||||
diff_span = (date - birth)
|
if birth:
|
||||||
stab.row(person, str(diff_span))
|
diff_span = (date - birth)
|
||||||
stab.row_sort_val(1, int(diff_span))
|
stab.row(person, str(diff_span), _("Alive: %s") % explain)
|
||||||
matches += 1
|
stab.row_sort_val(1, int(diff_span))
|
||||||
|
else:
|
||||||
|
stab.row(person, "", _("Alive: %s") % explain)
|
||||||
|
stab.row_sort_val(1, 0)
|
||||||
|
alive_matches += 1
|
||||||
|
else:
|
||||||
|
if birth:
|
||||||
|
diff_span = (date - birth)
|
||||||
|
stab.row(person, str(diff_span), _("Deceased: %s") % explain)
|
||||||
|
stab.row_sort_val(1, int(diff_span))
|
||||||
|
else:
|
||||||
|
stab.row(person, "", _("Deceased: %s") % explain)
|
||||||
|
stab.row_sort_val(1, 1)
|
||||||
|
dead_matches += 1
|
||||||
|
|
||||||
document.has_data = matches > 0
|
document.has_data = (alive_matches + dead_matches) > 0
|
||||||
sdoc.paragraph(_("\n%d matches.\n") % matches)
|
sdoc.paragraph(_("\nLiving matches: %d, Deceased matches: %d\n") % (alive_matches, dead_matches))
|
||||||
stab.write(sdoc)
|
stab.write(sdoc)
|
||||||
sdoc.paragraph("")
|
sdoc.paragraph("")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user