Bug fixes
This commit is contained in:
parent
c3be926ff7
commit
7755bcf668
|
@ -24,7 +24,7 @@ def format_list_with_ampersand(items: list[str]) -> str:
|
||||||
|
|
||||||
def get_country(alpha_2: str) -> pycountry.db.Country | None:
|
def get_country(alpha_2: str) -> pycountry.db.Country | None:
|
||||||
"""Lookup country by alpha-2 country code."""
|
"""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")
|
return pycountry.db.Country(flag="🇪🇺", name="ESA")
|
||||||
if not alpha_2:
|
if not alpha_2:
|
||||||
return None
|
return None
|
||||||
|
@ -33,9 +33,10 @@ def get_country(alpha_2: str) -> pycountry.db.Country | None:
|
||||||
flag="\U0001F1FD\U0001F1F0", name="Kosovo", alpha_2="xk"
|
flag="\U0001F1FD\U0001F1F0", name="Kosovo", alpha_2="xk"
|
||||||
)
|
)
|
||||||
|
|
||||||
country: pycountry.db.Country
|
country: pycountry.db.Country = None
|
||||||
if len(alpha_2) == 2:
|
if len(alpha_2) == 2:
|
||||||
country = pycountry.countries.get(alpha_2=alpha_2.upper())
|
country = pycountry.countries.get(alpha_2=alpha_2.upper())
|
||||||
elif len(alpha_2) == 3:
|
elif len(alpha_2) == 3:
|
||||||
country = pycountry.countries.get(alpha_3=alpha_2.upper())
|
country = pycountry.countries.get(alpha_3=alpha_2.upper())
|
||||||
|
|
||||||
return country
|
return country
|
||||||
|
|
|
@ -45,7 +45,7 @@ def build_events(events: list[Event]) -> list[dict[str, typing.Any]]:
|
||||||
|
|
||||||
item = {
|
item = {
|
||||||
"allDay": False,
|
"allDay": False,
|
||||||
"title": "checkin: " + e.title,
|
"title": "check-in: " + e.title,
|
||||||
"start": e.date.isoformat(),
|
"start": e.date.isoformat(),
|
||||||
"url": e.url,
|
"url": e.url,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue