From 3615b810e476c8f58d4bdd715728686b2c0a0436 Mon Sep 17 00:00:00 2001 From: Tzahi12345 Date: Tue, 6 Jun 2023 01:23:06 -0400 Subject: [PATCH] Minor categories refactor --- backend/categories.js | 6 ++---- backend/test/tests.js | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/backend/categories.js b/backend/categories.js index 2faebfb..c76368b 100644 --- a/backend/categories.js +++ b/backend/categories.js @@ -32,10 +32,8 @@ async function categorize(file_jsons) { return null; } - for (let i = 0; i < file_jsons.length; i++) { - const file_json = file_jsons[i]; - for (let j = 0; j < categories.length; j++) { - const category = categories[j]; + for (const file_json of file_jsons) { + for (const category of categories) { const rules = category['rules']; // if rules for current category apply, then that is the selected category diff --git a/backend/test/tests.js b/backend/test/tests.js index 447eaa4..560e925 100644 --- a/backend/test/tests.js +++ b/backend/test/tests.js @@ -842,7 +842,7 @@ describe('Categories', async function() { rules: [], custom_output: '' }; - + await db_api.removeAllRecords('categories', {name: 'test_category'}); await db_api.insertRecordIntoTable('categories', new_category); });