@@ -317,7 +317,7 @@ def _parse_filters(self, filters, coll_id=None):
317
317
318
318
filt = filt .upper ()
319
319
320
- if not any ( x in filt for x in self .operators ):
320
+ if all ( x not in filt for x in self .operators ):
321
321
print (f"Filter '{ filt } ' entered incorrectly." )
322
322
continue
323
323
@@ -338,13 +338,21 @@ def _parse_filters(self, filters, coll_id=None):
338
338
339
339
if key not in coll_fields .get_eod_fieldnames ():
340
340
err = f"Filter '{ key } ' is not available for Collection " \
341
- f"'{ coll_id } '."
341
+ f"'{ coll_id } '."
342
342
self .print_msg (f"WARNING: { err } " )
343
343
self .logger .warning (err )
344
344
continue
345
345
346
346
fld = coll_fields .get_field (key ).get_rapi_id ()
347
347
348
+ # Modified operator if maximum or minimum
349
+ if key .lower ().find ('maximum' ) > - 1 and \
350
+ fld .lower ().find ('maximum' ) == - 1 :
351
+ op = "<="
352
+ elif key .lower ().find ('minimum' ) > - 1 and \
353
+ fld .lower ().find ('minimum' ) == - 1 :
354
+ op = ">="
355
+
348
356
val = filt_split [1 ].strip ()
349
357
val = val .replace ('"' , '' ).replace ("'" , '' )
350
358
@@ -1262,8 +1270,8 @@ def query_entries(self, collections, **kwargs):
1262
1270
# Parse filters
1263
1271
if filters :
1264
1272
1265
- # print(f"self.coll_id: {self.coll_id}")
1266
- # print(f"filters.keys(): {filters.keys()}")
1273
+ print (f"self.coll_id: { self .coll_id } " )
1274
+ print (f"filters.keys(): { filters .keys ()} " )
1267
1275
1268
1276
if self .coll_id in filters .keys ():
1269
1277
coll_filts = filters [self .coll_id ]
@@ -1286,10 +1294,8 @@ def query_entries(self, collections, **kwargs):
1286
1294
if av_fields is None :
1287
1295
return None
1288
1296
1289
- for k in filt_parse .keys ():
1290
- if k in av_fields ['results' ]:
1291
- result_fields .append (k )
1292
-
1297
+ result_fields .extend (k for k in filt_parse .keys ()
1298
+ if k in av_fields ['results' ])
1293
1299
# Send a query to the EODMSRAPI object
1294
1300
print (f"\n Sending query to EODMSRAPI with the following "
1295
1301
f"parameters:" )
0 commit comments