* src/Utils.py (probably_alive): If no year is given it now treats people as dead when they have a death event instead of counting them as alive in the curent year when they died in the current year.

svn: r4752
This commit is contained in:
Martin Hawlisch 2005-06-01 20:36:23 +00:00
parent f283347987
commit 85fa8c09ea
2 changed files with 15 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2005-06-01 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/Utils.py (probably_alive): If no year is given it now treats
people as dead when they have a death event instead of counting them
as alive in the curent year when they died in the current year.
2005-06-01 Anton Huber <anton_huber@gmx.de> 2005-06-01 Anton Huber <anton_huber@gmx.de>
* src/po/de.po: Updated translation * src/po/de.po: Updated translation

View File

@ -447,14 +447,13 @@ def probably_alive(person,db,current_year=None):
""" """
if not current_year:
time_struct = time.localtime(time.time())
current_year = time_struct[0]
death_year = None death_year = None
# If the recorded death year is before current year then # If the recorded death year is before current year then
# things are simple. # things are simple.
if person.death_handle: if person.death_handle:
if not current_year:
# no current year and we have a death event -> person died
return False
death = db.get_event_from_handle(person.death_handle) death = db.get_event_from_handle(person.death_handle)
if death.get_date_object().get_start_date() != Date.EMPTY: if death.get_date_object().get_start_date() != Date.EMPTY:
death_year = death.get_date_object().get_year() death_year = death.get_date_object().get_year()
@ -466,12 +465,19 @@ def probably_alive(person,db,current_year=None):
for ev_handle in person.event_list: for ev_handle in person.event_list:
ev = db.get_event_from_handle(ev_handle) ev = db.get_event_from_handle(ev_handle)
if ev and ev.name in ["Cause Of Death", "Burial", "Cremation"]: if ev and ev.name in ["Cause Of Death", "Burial", "Cremation"]:
if not current_year:
# no current year and we have an event related to death
return False
if not death_year: if not death_year:
death_year = ev.get_date_object().get_year() death_year = ev.get_date_object().get_year()
if ev.get_date_object().get_start_date() != Date.EMPTY: if ev.get_date_object().get_start_date() != Date.EMPTY:
if ev.get_date_object().get_year() < current_year: if ev.get_date_object().get_year() < current_year:
return False return False
if not current_year:
time_struct = time.localtime(time.time())
current_year = time_struct[0]
birth_year = None birth_year = None
# If they were born within 100 years before current year then # If they were born within 100 years before current year then
# assume they are alive (we already know they are not dead). # assume they are alive (we already know they are not dead).