Webcal: Include only events after year

This commit is contained in:
SNoiraud 2019-03-10 11:36:49 +01:00 committed by Nick Hall
parent 2f9704c680
commit 76961fd675

View File

@ -140,6 +140,7 @@ class WebCalReport(Report):
self.multiyear = mgobn('multiyear')
self.start_year = mgobn('start_year')
self.end_year = mgobn('end_year')
self.after_year = mgobn('after_year')
if not self.multiyear:
self.end_year = self.start_year
if self.end_year < self.start_year:
@ -291,6 +292,9 @@ class WebCalReport(Report):
the age_at_death
"""
if year <= self.after_year:
return
# This may happen for certain "about" dates.
# Use first day of the month
if day == 0:
@ -1633,6 +1637,7 @@ class WebCalOptions(MenuReportOptions):
self.__multiyear = None
self.__start_year = None
self.__end_year = None
self.__after_year = None
def add_menu_options(self, menu):
"""
@ -1641,8 +1646,8 @@ class WebCalOptions(MenuReportOptions):
self.__add_report_options(menu)
self.__add_report2_options(menu)
self.__add_content_options(menu)
self.__add_notes_options(menu)
self.__add_advanced_options(menu)
self.__add_notes_options(menu)
def __add_report_options(self, menu):
"""
@ -1891,6 +1896,16 @@ class WebCalOptions(MenuReportOptions):
menu.add_option(category_name, 'link_to_narweb', self.__links)
self.__links.connect('value-changed', self.__links_changed)
today = Today()
default_before = config.get('behavior.max-age-prob-alive')
self.__after_year = NumberOption(_('Show data only after year'),
(today.get_year() - default_before),
0, today.get_year())
self.__after_year.set_help(_("Don't show data before this year."
" should be before current year - "
" 100"))
menu.add_option(category_name, 'after_year', self.__after_year)
dbname = self.__db.get_dbname()
default_prefix = '../../' + dbname + "_NAVWEB/"
self.__prefix = StringOption(_('Link prefix'), default_prefix)