فهرست منبع

minor changes

Enzo 1 سال پیش
والد
کامیت
6e686f4668
2فایلهای تغییر یافته به همراه6 افزوده شده و 22 حذف شده
  1. 2 18
      services/query.service.ts
  2. 4 4
      test/test1.ts

+ 2 - 18
services/query.service.ts

@@ -28,7 +28,7 @@ export class queryService {
         }, 250)
     }
 
-    // Search and Filter: Pure Observables. To be moved out to become a separate service again.
+    // Search and Filter: Pure Observables
     private filterFromObs(dataFromStorage: Subject<any>, filteredResult: Subject<any>, ...conditions: Conditions[]) {
         dataFromStorage.subscribe({
             next: element => {
@@ -71,29 +71,13 @@ export class queryService {
                 return false;
             }
 
-            // Check data to see if it is within the date range.
+            // Check data to see if the given data is within the date range of the specified column
             if (recordFound == true) {
                 if (searchObj.hasOwnProperty("$dateRange")) {
                     recordFound = this.filterByDateRange(data, searchObj.$dateRange)
                     delete searchObj.$dateRange
                 }
             }
-            
-            // Check data if there is any $msgTag property and match it
-            if (recordFound == true) {
-                if (searchObj.hasOwnProperty('$msgTag')) {
-                    let keyToExtract = '$msgTag';
-                    let [, extractedValue] = Object.entries(searchObj).find(([key]) => key === keyToExtract)
-                    let newObj = { [keyToExtract]: extractedValue };
-                    let oldKey = '$msgTag';
-                    let newKey = 'msgTag';
-                    let newPair = { [newKey]: newObj[oldKey] };
-                    delete newObj[oldKey];
-                    // console.log(newPair)
-                    recordFound = this.matchValues(data, newPair)
-                    delete searchObj.$msgTag
-                }
-            }
 
             // Check if the regular expression value matches any of the data string
             if (recordFound == true) {

+ 4 - 4
test/test1.ts

@@ -51,7 +51,7 @@ let conditions5: Conditions[] = [
             'column': "data.data.appData.msgDateTime"
         }
     },
-    { '$msgTag': ['basic'] },
+    { 'msgTag': ['basic'] },
     { "msgId": "4f710c4b-a258-4c7e-a4b6-6095bb7028e9" },
     { "msgLogDateTime": "2023-01-14T21:50:19.917Z" }
 ]
@@ -66,7 +66,7 @@ let conditions6: Conditions[] = [
         }
     },
     { "$regex": "maxime voluptatibus ad quasi eveniet" },
-    { '$msgTag': ['basic'] },
+    { 'msgTag': ['basic'] },
     { "msgId": "4f710c4b-a258-4c7e-a4b6-6095bb7028e9" },
 ]
 
@@ -80,7 +80,7 @@ let conditions7: Conditions[] = [
         }
     },
     { "$regex": "maxime voluptatibus ad quasi eveniet" },
-    // { 'data.data.appData.$msgTag': ['basic'] },
+    // { 'data.data.appData.msgTag': ['basic'] },
     { "data.data.appData.msgId": "4f710c4b-a258-4c7e-a4b6-6095bb7028e9" },
     { "msgLogDateTime": "2023-01-14T21:50:19.917Z" }
 ]
@@ -94,7 +94,7 @@ let conditions8: Conditions[] = [
         }
     },
     { "$regex": "maxime voluptatibus ad quasi eveniet" },
-    { '$msgTag': ['basic'] },
+    { 'msgTag': ['basic'] },
     { "data.data.appDatamsgId": "4f710c4b-a258-4c7e-a4b6-6095bb7028e9" },
     { "header.msgLogDateTime": "2023-01-14T21:50:19.917Z" }
 ]