From 81f86b6538fed71ad751a95d2e9e1b81b5d4fb2b Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev Date: Sun, 25 Jan 2026 22:01:54 +0700 Subject: [PATCH] Fix nodes_count query bind_vars - only add bounds when present --- geo_app/schema.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) 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):