Skip to content

Commit 50c5bf8

Browse files
committed
fix: 500 error on education page
1 parent 77f9e35 commit 50c5bf8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

kotlin-website.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,13 @@ def get_nav():
129129
return nav
130130

131131
def get_countries_size():
132-
def match_string(string):
133-
return re.search(r'\((.*?)\)', string.get("location")).group(1)
134-
matches = set(map(match_string, site_data['universities']))
132+
def match_string(entry):
133+
location = entry.get("location", "")
134+
# Extract the last part as the country code
135+
return location.split(",")[-1].strip()
136+
137+
# Extract unique countries, ignoring any None results
138+
matches = set(filter(None, map(match_string, site_data['universities'])))
135139
return len(matches)
136140

137141

0 commit comments

Comments
 (0)