* src/Utils.py: fix probably_alive to handle year offset properly
* src/plugins/NavWebPage.py: handle new probably_alive function svn: r5140
This commit is contained in:
parent
a67f26ff8d
commit
10e4f7338f
@ -1,3 +1,7 @@
|
|||||||
|
2005-08-29 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/Utils.py: fix probably_alive to handle year offset properly
|
||||||
|
* src/plugins/NavWebPage.py: handle new probably_alive function
|
||||||
|
|
||||||
2005-08-29 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
2005-08-29 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||||
* src/plugins/NavWebPage.py: Correct link to Surname list page;
|
* src/plugins/NavWebPage.py: Correct link to Surname list page;
|
||||||
Better handling for not existing media object files and note-only
|
Better handling for not existing media object files and note-only
|
||||||
|
@ -450,7 +450,7 @@ def create_id():
|
|||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
||||||
def probably_alive(person,db,current_year=None):
|
def probably_alive(person,db,current_year=None,limit=0):
|
||||||
"""Returns true if the person may be alive.
|
"""Returns true if the person may be alive.
|
||||||
|
|
||||||
This works by a process of emlimination. If we can't find a good
|
This works by a process of emlimination. If we can't find a good
|
||||||
@ -469,7 +469,7 @@ def probably_alive(person,db,current_year=None):
|
|||||||
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()
|
||||||
if death_year < current_year:
|
if death_year - limit < current_year:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Look for Cause Of Death, Burial or Cremation events.
|
# Look for Cause Of Death, Burial or Cremation events.
|
||||||
@ -483,7 +483,7 @@ def probably_alive(person,db,current_year=None):
|
|||||||
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() - limit < current_year:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not current_year:
|
if not current_year:
|
||||||
@ -498,21 +498,15 @@ def probably_alive(person,db,current_year=None):
|
|||||||
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()
|
||||||
if birth.get_date_object().get_year() > current_year:
|
|
||||||
# person is not yet born
|
|
||||||
return False
|
|
||||||
r = not_too_old(birth.get_date_object(),current_year)
|
r = not_too_old(birth.get_date_object(),current_year)
|
||||||
if r:
|
if r:
|
||||||
#print person.get_primary_name().get_name(), " is alive because they were born late enough."
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
if not birth_year and death_year:
|
if not birth_year and death_year:
|
||||||
if death_year > current_year + 110:
|
if death_year > current_year + 110:
|
||||||
# person died more tha 110 after current year
|
# person died more tha 110 after current year
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
# Neither birth nor death events are available. Try looking
|
# Neither birth nor death events are available. Try looking
|
||||||
# for descendants that were born more than a lifespan ago.
|
# for descendants that were born more than a lifespan ago.
|
||||||
|
|
||||||
@ -616,7 +610,6 @@ def probably_alive(person,db,current_year=None):
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
# If there are ancestors that would be too old in the current year
|
# If there are ancestors that would be too old in the current year
|
||||||
# then assume our person must be dead too.
|
# then assume our person must be dead too.
|
||||||
if ancestors_too_old (person, current_year):
|
if ancestors_too_old (person, current_year):
|
||||||
|
@ -1876,7 +1876,7 @@ class WebReport(Report.Report):
|
|||||||
self.progress.set_pass(_('Applying privacy filter'),len(ind_list))
|
self.progress.set_pass(_('Applying privacy filter'),len(ind_list))
|
||||||
ind_list = filter(self.filter_private,ind_list)
|
ind_list = filter(self.filter_private,ind_list)
|
||||||
|
|
||||||
years = time.localtime(time.time())[0] - self.restrict_years
|
years = time.localtime(time.time())[0]
|
||||||
|
|
||||||
# Filter out people who are restricted due to the living
|
# Filter out people who are restricted due to the living
|
||||||
# people rule
|
# people rule
|
||||||
@ -1886,7 +1886,7 @@ class WebReport(Report.Report):
|
|||||||
for key in ind_list:
|
for key in ind_list:
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
p = self.database.get_person_from_handle(key)
|
p = self.database.get_person_from_handle(key)
|
||||||
if Utils.probably_alive(p,self.database,years):
|
if Utils.probably_alive(p,self.database,years,self.restrict_years):
|
||||||
restrict_list.add(key)
|
restrict_list.add(key)
|
||||||
|
|
||||||
return (ind_list,restrict_list)
|
return (ind_list,restrict_list)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user