From 5e922f34c181ffc7cb089739b10907efa9891eec Mon Sep 17 00:00:00 2001
From: Himanshu Aggarwal <aggarwah@mcmaster.ca>
Date: Tue, 8 Mar 2022 17:08:02 -0500
Subject: [PATCH] Fix useFilters hook; Add initial filters

---
 src/cryptometrics/constants/constants.js | 35 ++++++++++++++++++++++++
 src/cryptometrics/hooks/useFilters.js    |  4 +--
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/src/cryptometrics/constants/constants.js b/src/cryptometrics/constants/constants.js
index 69f6af6..05bcdbb 100644
--- a/src/cryptometrics/constants/constants.js
+++ b/src/cryptometrics/constants/constants.js
@@ -98,3 +98,38 @@ export const cryptocurrencies = [
     name: "Cardano",
   },
 ];
+
+export const filterOptions = {
+  price: {
+    id: "price",
+    name: "Price",
+    options: {
+      equals: {
+        id: "equals",
+        name: "is",
+      },
+      less_than: {
+        id: "less_than",
+        name: "is less than",
+      },
+      greater_than: {
+        id: "greater_than",
+        name: "is greater than",
+      },
+    },
+  },
+  name: {
+    id: "name",
+    name: "Name",
+    options: {
+      equals: {
+        id: "equals",
+        name: "is",
+      },
+      less_than: {
+        id: "contains",
+        name: "contains",
+      },
+    },
+  },
+};
diff --git a/src/cryptometrics/hooks/useFilters.js b/src/cryptometrics/hooks/useFilters.js
index 02e7767..145c8d4 100644
--- a/src/cryptometrics/hooks/useFilters.js
+++ b/src/cryptometrics/hooks/useFilters.js
@@ -36,8 +36,8 @@ export default function useFilters(initialArray) {
     setFilters(
       filters.filter(({ subject, condition, value }) => {
         return (
-          subject !== filter.subject &&
-          condition !== filter.condition &&
+          subject !== filter.subject ||
+          condition !== filter.condition ||
           value !== filter.value
         );
       })
-- 
GitLab