Skip to content

Commit fc0076c

Browse files
Code optimised
1 parent 0e22b78 commit fc0076c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

graphene_mongo/fields.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,16 @@ def filter_args(self):
148148
if self._type._meta.filter_fields:
149149
for field, filter_collection in self._type._meta.filter_fields.items():
150150
for each in filter_collection:
151-
if each == 'max_distance' and str(self._type._meta.fields[field].type) == 'PointFieldType':
152-
filter_type = graphene.Int
153-
else:
154-
filter_type = getattr(
155-
graphene,
156-
str(self._type._meta.fields[field].type).replace("!", ""),
157-
)
158-
151+
filter_type = getattr(
152+
graphene,
153+
str(self._type._meta.fields[field].type).replace("!", ""),
154+
)
159155
# handle special cases
160156
advanced_filter_types = {
161157
"in": graphene.List(filter_type),
162158
"nin": graphene.List(filter_type),
163159
"all": graphene.List(filter_type),
160+
"max_distance": graphene.Int
164161
}
165162

166163
filter_type = advanced_filter_types.get(each, filter_type)

0 commit comments

Comments
 (0)