diff options
| author | Fuwn <[email protected]> | 2023-09-28 16:30:50 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-09-28 16:30:50 -0700 |
| commit | ffaac063d9b8f818fb7b8232b9fadfdc5db3e523 (patch) | |
| tree | 197cd054e719f24d06d56665f120faa07d463d03 /src/lib | |
| parent | fix(wrapped): filter highest by current year (diff) | |
| download | due.moe-ffaac063d9b8f818fb7b8232b9fadfdc5db3e523.tar.xz due.moe-ffaac063d9b8f818fb7b8232b9fadfdc5db3e523.zip | |
refactor(media): filter duplicates at source
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/AniList/media.ts | 8 | ||||
| -rw-r--r-- | src/lib/List/Due/AnimeList.svelte | 8 | ||||
| -rw-r--r-- | src/lib/List/UpcomingAnimeList.svelte | 8 | ||||
| -rw-r--r-- | src/lib/List/WatchingAnimeList.svelte | 8 |
4 files changed, 7 insertions, 25 deletions
diff --git a/src/lib/AniList/media.ts b/src/lib/AniList/media.ts index 5c59e5e9..d41e48fb 100644 --- a/src/lib/AniList/media.ts +++ b/src/lib/AniList/media.ts @@ -57,7 +57,13 @@ export const flattenLists = (lists: { entries: { media: Media }[] }[]) => { minimisedList[position] = entry.media; } - return minimisedList; + return minimisedList.filter((item, index, array) => { + return ( + array.findIndex((i) => { + return i.id === item.id; + }) === index + ); + }); }; export const mediaListCollection = async ( diff --git a/src/lib/List/Due/AnimeList.svelte b/src/lib/List/Due/AnimeList.svelte index 7d650ec0..4d22df14 100644 --- a/src/lib/List/Due/AnimeList.svelte +++ b/src/lib/List/Due/AnimeList.svelte @@ -85,14 +85,6 @@ } }); - finalMedia = finalMedia.filter((item, index, array) => { - return ( - array.findIndex((i) => { - return i.id === item.id; - }) === index - ); - }); - if (!endTime || endTime === -1) { endTime = performance.now() - startTime; } diff --git a/src/lib/List/UpcomingAnimeList.svelte b/src/lib/List/UpcomingAnimeList.svelte index 0f4f22c3..14c9ed34 100644 --- a/src/lib/List/UpcomingAnimeList.svelte +++ b/src/lib/List/UpcomingAnimeList.svelte @@ -54,14 +54,6 @@ ); }); - finalMedia = finalMedia.filter((item, index, array) => { - return ( - array.findIndex((i) => { - return i.id === item.id; - }) === index - ); - }); - if (!endTime) { endTime = performance.now() - startTime; } diff --git a/src/lib/List/WatchingAnimeList.svelte b/src/lib/List/WatchingAnimeList.svelte index b3e54e6d..567f0e6c 100644 --- a/src/lib/List/WatchingAnimeList.svelte +++ b/src/lib/List/WatchingAnimeList.svelte @@ -43,14 +43,6 @@ return difference(a) - difference(b); }); - finalMedia = finalMedia.filter((item, index, array) => { - return ( - array.findIndex((i) => { - return i.id === item.id; - }) === index - ); - }); - if (!endTime) { endTime = performance.now() - startTime; } |