diff --git a/src/public/js/components/modal/watchlistAddItem.js b/src/public/js/components/modal/watchlistAddItem.js index b2e14a92fa3e7e63beb9890a72499c7d1e8b9ed0..739714a72cea223c4bd925c53c7b425ed32e48b4 100644 --- a/src/public/js/components/modal/watchlistAddItem.js +++ b/src/public/js/components/modal/watchlistAddItem.js @@ -116,7 +116,7 @@ function fetchSearch(replace = false) { e.addEventListener('click', () => { if (!catalogSelected.includes(e.dataset.id)) { - if (catalogSelected.length === MAX_ITEMS) { + if (catalogSelected.length >= MAX_ITEMS) { showToast("Failed", "You can add up to 50 items"); setTimeout(() => { const toast = document.querySelector("#toast"); @@ -163,6 +163,7 @@ function fetchSearch(replace = false) { } function getCatalogSelected() { + catalogSelected = []; const btnDelete = document.querySelectorAll("button.watchlist-item__delete"); btnDelete.forEach(btn => { diff --git a/src/server/app/Service/WatchlistService.php b/src/server/app/Service/WatchlistService.php index 5ccd7f52c4a1a64095792ee98e91c86b347ca398..0f3a12bd9c7ac5f7e2fe1d1a2d81cda9124c2cf3 100644 --- a/src/server/app/Service/WatchlistService.php +++ b/src/server/app/Service/WatchlistService.php @@ -55,7 +55,6 @@ class WatchlistService $watchlist->visibility = $watchlistCreateRequest->visibility; $watchlist->category = "DRAMA"; $watchlist->userId = $watchlistCreateRequest->userId; - $watchlist->itemCount = count($watchlistCreateRequest->items); // check watchlist category by travers through items $cntDrama = 0; @@ -121,7 +120,6 @@ class WatchlistService $watchlist->visibility = $watchlistEditRequest->visibility; $watchlist->category = "DRAMA"; $watchlist->userId = $watchlistEditRequest->userId; - $watchlist->itemCount = count($watchlistEditRequest->items); // check watchlist category by travers through items $cntDrama = 0;