Skip to content

Commit

Permalink
fix: 500 error on education page
Browse files Browse the repository at this point in the history
  • Loading branch information
nikpachoo committed Oct 27, 2024
1 parent 77f9e35 commit 50c5bf8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions kotlin-website.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,13 @@ def get_nav():
return nav

def get_countries_size():
def match_string(string):
return re.search(r'\((.*?)\)', string.get("location")).group(1)
matches = set(map(match_string, site_data['universities']))
def match_string(entry):
location = entry.get("location", "")
# Extract the last part as the country code
return location.split(",")[-1].strip()

# Extract unique countries, ignoring any None results
matches = set(filter(None, map(match_string, site_data['universities'])))
return len(matches)


Expand Down

0 comments on commit 50c5bf8

Please sign in to comment.