From 2e7f5e78630fcd2415ade610c43c51365d26d9e2 Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev Date: Sun, 25 Jan 2026 21:54:22 +0700 Subject: [PATCH] Fix nodes query bind_vars - only add bounds when all coordinates present --- geo_app/schema.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/geo_app/schema.py b/geo_app/schema.py index f489ee9..376af89 100644 --- a/geo_app/schema.py +++ b/geo_app/schema.py @@ -482,20 +482,24 @@ class Query(graphene.ObjectType): LIMIT @offset, @limit RETURN node """ - cursor = db.aql.execute( - aql, - bind_vars={ - 'transport_type': transport_type, - 'country': country, - 'search': search, - 'offset': 0 if offset is None else offset, - 'limit': 1000000 if limit is None else limit, + bind_vars = { + 'transport_type': transport_type, + 'country': country, + 'search': search, + 'offset': 0 if offset is None else offset, + 'limit': 1000000 if limit is None else limit, + } + + # 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) nodes = [] for node in cursor: