* src/Utils.py (probably_alive): return False if any event
of the person happened over 150 years ago; (too_old): add function; (not_too_old): require definite year for a positive decision. svn: r5508
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2005-12-08 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/Utils.py (probably_alive): return False if any event
|
||||||
|
of the person happened over 150 years ago; (too_old): add
|
||||||
|
function; (not_too_old): require definite year for a positive
|
||||||
|
decision.
|
||||||
|
|
||||||
2005-12-07 Eero Tamminen <eerot@sf>
|
2005-12-07 Eero Tamminen <eerot@sf>
|
||||||
* src/po/fi.po: Translation update to latest template
|
* src/po/fi.po: Translation update to latest template
|
||||||
|
|
||||||
|
@@ -538,6 +538,10 @@ def probably_alive(person,db,current_year=None,limit=0):
|
|||||||
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() - limit < current_year:
|
if ev.get_date_object().get_year() - limit < current_year:
|
||||||
return False
|
return False
|
||||||
|
# For any other event of this person, check whether it happened
|
||||||
|
# too long ago. If so then the person is likely dead now.
|
||||||
|
elif ev and too_old(ev.get_date_object(),current_year):
|
||||||
|
return False
|
||||||
|
|
||||||
if not current_year:
|
if not current_year:
|
||||||
time_struct = time.localtime(time.time())
|
time_struct = time.localtime(time.time())
|
||||||
@@ -551,8 +555,11 @@ def probably_alive(person,db,current_year=None,limit=0):
|
|||||||
if birth.get_date_object().get_start_date() != Date.EMPTY:
|
if birth.get_date_object().get_start_date() != Date.EMPTY:
|
||||||
if not birth_year:
|
if not birth_year:
|
||||||
birth_year = birth.get_date_object().get_year()
|
birth_year = birth.get_date_object().get_year()
|
||||||
r = not_too_old(birth.get_date_object(),current_year)
|
# Check whether the birth event is too old because the
|
||||||
if r:
|
# code above did not look at birth, only at other events
|
||||||
|
if too_old(birth.get_date_object(),current_year):
|
||||||
|
return False
|
||||||
|
if not_too_old(birth.get_date_object(),current_year):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if not birth_year and death_year:
|
if not birth_year and death_year:
|
||||||
@@ -682,7 +689,18 @@ def not_too_old(date,current_year=None):
|
|||||||
year = date.get_year()
|
year = date.get_year()
|
||||||
if year > current_year:
|
if year > current_year:
|
||||||
return False
|
return False
|
||||||
return not( year != 0 and current_year - year > 110)
|
return (year != 0 and current_year - year < 110)
|
||||||
|
|
||||||
|
def too_old(date,current_year=None):
|
||||||
|
if current_year:
|
||||||
|
the_current_year = current_year
|
||||||
|
else:
|
||||||
|
time_struct = time.localtime(time.time())
|
||||||
|
the_current_year = time_struct[0]
|
||||||
|
year = date.get_year()
|
||||||
|
if year > the_current_year:
|
||||||
|
return True
|
||||||
|
return (year != 0 and the_current_year - year > 150)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user