parent
a109af2536
commit
bf5f7f2276
|
@ -37,8 +37,6 @@ here = dateutil.tz.tzlocal()
|
|||
|
||||
next_us_presidential_election = date(2024, 11, 5)
|
||||
|
||||
xmas_last_posting_dates = {"first": date(2023, 12, 20), "second": date(2023, 12, 18)}
|
||||
|
||||
# deadline to file tax return
|
||||
# credit card expiry dates
|
||||
# morzine ski lifts
|
||||
|
@ -163,6 +161,18 @@ def combine_holidays(events: list[Event]) -> list[Event]:
|
|||
return list(combined.values())
|
||||
|
||||
|
||||
def xmas_last_posting(config: configparser.ConfigParser) -> list[Event]:
|
||||
"""Last posting days for Christmas."""
|
||||
return [
|
||||
Event(
|
||||
name=f"xmas_last_{key}",
|
||||
date=date.fromisoformat(config["xmas_last_posting_dates"][key]),
|
||||
url="https://www.postoffice.co.uk/last-posting-dates",
|
||||
)
|
||||
for key in ("first", "second")
|
||||
]
|
||||
|
||||
|
||||
async def get_data(now: datetime) -> typing.Mapping[str, str | object]:
|
||||
"""Get data to display on agenda dashboard."""
|
||||
config_filename = os.path.join(os.path.dirname(__file__), "..", "config")
|
||||
|
@ -215,7 +225,6 @@ async def get_data(now: datetime) -> typing.Mapping[str, str | object]:
|
|||
"mothers_day": uk_holiday.get_mothers_day(today),
|
||||
"fathers_day": uk_holiday.get_fathers_day(today),
|
||||
"uk_financial_year_end": uk_financial_year_end(last_year, next_year),
|
||||
"xmas_last_posting_dates": xmas_last_posting_dates,
|
||||
"gwr_advance_tickets": gwr_advance_tickets,
|
||||
"critical_mass": critical_mass(last_year, next_year),
|
||||
"market": (
|
||||
|
@ -226,7 +235,7 @@ async def get_data(now: datetime) -> typing.Mapping[str, str | object]:
|
|||
"rockets": rockets,
|
||||
}
|
||||
|
||||
skip = {"now", "gbpusd", "rockets", "stock_markets", "xmas_last_posting_dates"}
|
||||
skip = {"now", "gbpusd", "rockets", "stock_markets"}
|
||||
events: list[Event] = []
|
||||
for key, value in reply.items():
|
||||
if key in skip:
|
||||
|
@ -242,15 +251,6 @@ async def get_data(now: datetime) -> typing.Mapping[str, str | object]:
|
|||
reply["sunrise"] = sun.sunrise(observer)
|
||||
reply["sunset"] = sun.sunset(observer)
|
||||
|
||||
for key, value in xmas_last_posting_dates.items():
|
||||
events.append(
|
||||
Event(
|
||||
name=f"xmas_last_{key}",
|
||||
date=value,
|
||||
url="https://www.postoffice.co.uk/last-posting-dates",
|
||||
)
|
||||
)
|
||||
|
||||
events += combine_holidays(bank_holiday + get_us_holidays(last_year, next_year))
|
||||
|
||||
my_data = config["data"]["personal-data"]
|
||||
|
@ -259,6 +259,7 @@ async def get_data(now: datetime) -> typing.Mapping[str, str | object]:
|
|||
events += travel.all_events(config["data"]["personal-data"])
|
||||
events += conference.get_list(os.path.join(my_data, "conferences.yaml"))
|
||||
events += backwell_bins + bristol_bins
|
||||
events += xmas_last_posting(config)
|
||||
|
||||
events += subscription.get_events(os.path.join(my_data, "subscriptions.yaml"))
|
||||
|
||||
|
|
Loading…
Reference in a new issue