From 11111bbcb4339988db20738fd54da8a28577b9ae Mon Sep 17 00:00:00 2001 From: LocalNewsTV <62873746+LocalNewsTV@users.noreply.github.com> Date: Wed, 11 Oct 2023 07:15:17 -0700 Subject: [PATCH] bug fix + implement suggestions --- api/src/controllers/collection-controller.js | 2 +- api/test/factories/factory_helper.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/controllers/collection-controller.js b/api/src/controllers/collection-controller.js index e0e1c5939..48701cd67 100644 --- a/api/src/controllers/collection-controller.js +++ b/api/src/controllers/collection-controller.js @@ -102,7 +102,7 @@ const updateCollection = async function(incomingObj, collectionId, displayName) let arrayOfObjIds = []; for(const record of incomingObj.records){ - if(recordIds.includes(record)){ + if(!recordIds.includes(record)){ recordsToAdd.push(record); arrayOfObjIds.push(new ObjectId(record)); } diff --git a/api/test/factories/factory_helper.js b/api/test/factories/factory_helper.js index 93aabf5dd..cfc50eb31 100644 --- a/api/test/factories/factory_helper.js +++ b/api/test/factories/factory_helper.js @@ -156,7 +156,7 @@ function hexaDecimal(count) { function generateSeededObjectId(value) { let oid = (typeof value === "undefined") ? hexaDecimal(24).toLocaleLowerCase() : value; - if (!bsonObjectId.isValid(oid)) throw new Error("Invalid attempt to generate an ObjectID: '" + oid + "'"); + if (!bsonObjectId.isValid(oid)) throw new Error(`Invalid attempt to generate an ObjectID: ${oid}`); return mongTypes.ObjectId(oid); }