From 6a1b9ef890f34a03e831cd100b41c915327fefb6 Mon Sep 17 00:00:00 2001 From: MasterGordon Date: Sat, 19 Oct 2024 23:50:15 +0200 Subject: [PATCH] added no dupe for lootbox --- backend/controller/userController.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/controller/userController.ts b/backend/controller/userController.ts index 5f24a84..b6dd2dc 100644 --- a/backend/controller/userController.ts +++ b/backend/controller/userController.ts @@ -147,9 +147,11 @@ export const userController = createController({ if (!lootbox) { throw new Error("Lootbox not found"); } - const itemsCopy = [...lootbox.items]; + let itemsCopy = [...lootbox.items]; if (lootbox.noDuplicates) { - itemsCopy.filter((i) => !collection.entries.some((e) => e.id === i.id)); + itemsCopy = itemsCopy.filter( + (i) => !collection.entries.some((e) => e.id === i.id), + ); } if (itemsCopy.length === 0) { throw new Error("No items left");