From 85fa8c09eaf71715424dc4cc051027496f2fff7d Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Wed, 1 Jun 2005 20:36:23 +0000 Subject: [PATCH] * 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 --- gramps2/ChangeLog | 5 +++++ gramps2/src/Utils.py | 14 ++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index b7918933f..6aa4e3ca6 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2005-06-01 Martin Hawlisch + * 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 * src/po/de.po: Updated translation diff --git a/gramps2/src/Utils.py b/gramps2/src/Utils.py index efcea4ba3..2e069ec00 100644 --- a/gramps2/src/Utils.py +++ b/gramps2/src/Utils.py @@ -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 # If the recorded death year is before current year then # things are simple. 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) if death.get_date_object().get_start_date() != Date.EMPTY: 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: ev = db.get_event_from_handle(ev_handle) 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: death_year = ev.get_date_object().get_year() if ev.get_date_object().get_start_date() != Date.EMPTY: if ev.get_date_object().get_year() < current_year: return False + if not current_year: + time_struct = time.localtime(time.time()) + current_year = time_struct[0] + birth_year = None # If they were born within 100 years before current year then # assume they are alive (we already know they are not dead).