Skip to content

Commit c41f439

Browse files
committed
Add correct city filtering
1 parent 017ed05 commit c41f439

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

src/database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def setup_database_indexes():
6262
game_collection.create_index([("sport", 1)], background=True)
6363
game_collection.create_index([("date", 1)], background=True)
6464
game_collection.create_index([("gender", 1)], background=True)
65-
game_collection.create_index([("location", 1)], background=True)
65+
game_collection.create_index([("city", 1)], background=True)
6666

6767
# Create compound indexes for common query combinations
6868
game_collection.create_index([("sport", 1), ("gender", 1)], background=True)

src/repositories/game_repository.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,10 @@ def find_by_location(onCampus):
256256
"""
257257
game_collection = db["game"]
258258

259-
CAMPUS_LOCATIONS = [
260-
"Ithaca, NY",
261-
"Lynah Rink"
262-
]
263-
264259
if onCampus:
265-
query = {"location": {"$in": CAMPUS_LOCATIONS}}
260+
query = {"city": "Ithaca"}
266261
else:
267-
query = {"location": {"$nin": CAMPUS_LOCATIONS}}
262+
query = {"city": {"$ne": "Ithaca"}}
268263

269264
games = game_collection.find(query)
270265

0 commit comments

Comments
 (0)