Skip to content

Commit fc90eb9

Browse files
fix: sort clubs by their display name
1 parent 74f4ba0 commit fc90eb9

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

extract_clubs.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ async def fetch_club_id(session, sem, club_url_id, club_name):
5050
soup = BeautifulSoup(html, "html.parser")
5151
section = soup.find("section", class_="show-club-checkin")
5252
if section and section.has_attr("data-club"):
53+
# Remove "Fitnessstudio" and strip whitespace
54+
display_name = club_name.replace("Fitnessstudio", "").strip()
5355
return {
54-
"name": club_name,
56+
"name": display_name,
5557
"url_id": club_url_id,
5658
"usage_id": section["data-club"]
5759
}
@@ -78,7 +80,7 @@ async def main():
7880
results.append(res)
7981

8082
# Sort by actual club name
81-
results.sort(key=lambda x: x["url_id"])
83+
results.sort(key=lambda x: x["name"])
8284

8385
# Save to JSON
8486
with open("clubs.json", "w", encoding="utf-8") as f:
@@ -98,9 +100,7 @@ def update_readme(clubs):
98100
table_lines = ["| Name | ID |",
99101
"|---------------------------------------------------------|------------|"]
100102
for club in clubs:
101-
# Remove "Fitnessstudio" and strip whitespace
102-
display_name = club['name'].replace("Fitnessstudio", "").strip()
103-
table_lines.append(f"| {display_name:<55} | {club['usage_id']:<10} |")
103+
table_lines.append(f"| {club['name']:<55} | {club['usage_id']:<10} |")
104104

105105
table_content = "\n".join(table_lines)
106106

0 commit comments

Comments
 (0)