3601: ALIVE algorithm needs someone alive today in the database; mistake fix on a variable name
svn: r14339
This commit is contained in:
parent
b5263657f5
commit
c4f2d4e596
11
src/Utils.py
11
src/Utils.py
@ -62,13 +62,11 @@ try:
|
|||||||
import config
|
import config
|
||||||
_MAX_AGE_PROB_ALIVE = config.get('behavior.max-age-prob-alive')
|
_MAX_AGE_PROB_ALIVE = config.get('behavior.max-age-prob-alive')
|
||||||
_MAX_SIB_AGE_DIFF = config.get('behavior.max-sib-age-diff')
|
_MAX_SIB_AGE_DIFF = config.get('behavior.max-sib-age-diff')
|
||||||
_MIN_GENERATION_YEARS = config.get('behavior.min-generation-years')
|
|
||||||
_AVG_GENERATION_GAP = config.get('behavior.avg-generation-gap')
|
_AVG_GENERATION_GAP = config.get('behavior.avg-generation-gap')
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# Utils used as module not part of GRAMPS
|
# Utils used as module not part of GRAMPS
|
||||||
_MAX_AGE_PROB_ALIVE = 110
|
_MAX_AGE_PROB_ALIVE = 110
|
||||||
_MAX_SIB_AGE_DIFF = 20
|
_MAX_SIB_AGE_DIFF = 20
|
||||||
_MIN_GENERATION_YEARS = 13
|
|
||||||
_AVG_GENERATION_GAP = 20
|
_AVG_GENERATION_GAP = 20
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -808,7 +806,8 @@ def probably_alive(person, db,
|
|||||||
:param avg_generation_gap: average generation gap, in years
|
:param avg_generation_gap: average generation gap, in years
|
||||||
"""
|
"""
|
||||||
pb = ProbablyAlive(db, max_sib_age_diff,
|
pb = ProbablyAlive(db, max_sib_age_diff,
|
||||||
max_age_prob_alive, avg_generation_gap)
|
max_age_prob_alive,
|
||||||
|
avg_generation_gap)
|
||||||
birth, death, explain, relative = pb.probably_alive_range(person)
|
birth, death, explain, relative = pb.probably_alive_range(person)
|
||||||
if current_date is None:
|
if current_date is None:
|
||||||
current_date = gen.lib.date.Today()
|
current_date = gen.lib.date.Today()
|
||||||
@ -833,7 +832,7 @@ def probably_alive(person, db,
|
|||||||
return True
|
return True
|
||||||
# if the current - birth is too big, not alive:
|
# if the current - birth is too big, not alive:
|
||||||
# FIXME: use match here:
|
# FIXME: use match here:
|
||||||
if (current_date - birth)[0] > max_age_prob_alive:
|
if (current_date - birth)[0] > pb.MAX_AGE_PROB_ALIVE:
|
||||||
if return_range:
|
if return_range:
|
||||||
return (False, birth, death, explain, relative)
|
return (False, birth, death, explain, relative)
|
||||||
else:
|
else:
|
||||||
@ -1171,11 +1170,9 @@ def update_constants():
|
|||||||
Used to update the constants that are cached in this module.
|
Used to update the constants that are cached in this module.
|
||||||
"""
|
"""
|
||||||
import config
|
import config
|
||||||
global _MAX_AGE_PROB_ALIVE, _MAX_SIB_AGE_DIFF, _MIN_GENERATION_YEARS, \
|
global _MAX_AGE_PROB_ALIVE, _MAX_SIB_AGE_DIFF, _AVG_GENERATION_GAP
|
||||||
_AVG_GENERATION_GAP
|
|
||||||
_MAX_AGE_PROB_ALIVE = config.get('behavior.max-age-prob-alive')
|
_MAX_AGE_PROB_ALIVE = config.get('behavior.max-age-prob-alive')
|
||||||
_MAX_SIB_AGE_DIFF = config.get('behavior.max-sib-age-diff')
|
_MAX_SIB_AGE_DIFF = config.get('behavior.max-sib-age-diff')
|
||||||
_MIN_GENERATION_YEARS = config.get('behavior.min-generation-years')
|
|
||||||
_AVG_GENERATION_GAP = config.get('behavior.avg-generation-gap')
|
_AVG_GENERATION_GAP = config.get('behavior.avg-generation-gap')
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user