Bug fixes

This commit is contained in:
Edward Betts 2025-01-24 18:43:49 +00:00
parent c3be926ff7
commit 7755bcf668
2 changed files with 4 additions and 3 deletions

View file

@ -24,7 +24,7 @@ def format_list_with_ampersand(items: list[str]) -> str:
def get_country(alpha_2: str) -> pycountry.db.Country | None:
"""Lookup country by alpha-2 country code."""
if alpha_2.count(",") > 10: # ESA
if alpha_2.count(",") > 3: # ESA
return pycountry.db.Country(flag="🇪🇺", name="ESA")
if not alpha_2:
return None
@ -33,9 +33,10 @@ def get_country(alpha_2: str) -> pycountry.db.Country | None:
flag="\U0001F1FD\U0001F1F0", name="Kosovo", alpha_2="xk"
)
country: pycountry.db.Country
country: pycountry.db.Country = None
if len(alpha_2) == 2:
country = pycountry.countries.get(alpha_2=alpha_2.upper())
elif len(alpha_2) == 3:
country = pycountry.countries.get(alpha_3=alpha_2.upper())
return country

View file

@ -45,7 +45,7 @@ def build_events(events: list[Event]) -> list[dict[str, typing.Any]]:
item = {
"allDay": False,
"title": "checkin: " + e.title,
"title": "check-in: " + e.title,
"start": e.date.isoformat(),
"url": e.url,
}