improve mapping of filter operators
authorGalen Charlton <gmc@equinoxinitiative.org>
Fri, 15 Nov 2019 21:55:59 +0000 (16:55 -0500)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 16 Jan 2020 21:38:28 +0000 (16:38 -0500)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.service.ts

index 140b29c..dbad57f 100644 (file)
@@ -62,7 +62,10 @@ const searchOptions = {
 };
 
 const operatorMap = {
-    "=": "",
+    ">": "__gte",
+    ">=": "__gte",
+    "<=": "__lte",
+    "<": "__lte",
 }
 
 @Injectable()
@@ -83,7 +86,9 @@ export class AcqSearchService {
 
             const searchTerm: Object = {};
             searchTerm[filterField] = filterVal;
-            searchTerm[operatorMap[filterOp]] = true;
+            if (filterOp in operatorMap) {
+                searchTerm[operatorMap[filterOp]] = true;
+            }
             baseSearch[coreRecType].push(searchTerm);
         });
         console.debug(baseSearch);