diff --git a/geo_app/schema.py b/geo_app/schema.py index 376af89..2e1bc6b 100644 --- a/geo_app/schema.py +++ b/geo_app/schema.py @@ -541,14 +541,21 @@ class Query(graphene.ObjectType): COLLECT WITH COUNT INTO length RETURN length """ - cursor = db.aql.execute(aql, bind_vars={ + bind_vars = { 'transport_type': transport_type, 'country': country, - 'west': west, - 'south': south, - 'east': east, - 'north': north, - }) + } + + # Only add bounds to bind_vars if they are used + if west is not None and south is not None and east is not None and north is not None: + bind_vars.update({ + 'west': west, + 'south': south, + 'east': east, + 'north': north, + }) + + cursor = db.aql.execute(aql, bind_vars=bind_vars) return next(cursor, 0) def resolve_hub_countries(self, info):