chore(recents): Use sql query to filter scanlators

This commit is contained in:
Ahmad Ansori Palembani 2024-06-21 09:25:43 +07:00
parent 7341e10822
commit 7926590c22
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
3 changed files with 36 additions and 7 deletions

View file

@ -32,6 +32,26 @@ AND (
:apply_filter = 0 OR S.name IS NULL
);
getRecents:
SELECT
M.url AS mangaUrl,
M.*,
C.*
FROM mangas AS M
JOIN chapters AS C
ON M._id = C.manga_id
LEFT JOIN scanlators_view AS S
ON C.manga_id = S.manga_id
AND ifnull(C.scanlator, 'N/A') = ifnull(S.name, '/<INVALID>/') -- I assume if it's N/A it shouldn't be filtered
WHERE M.favorite = 1
AND C.date_fetch > M.date_added
AND lower(M.title) LIKE :search
AND (
:apply_filter = 0 OR S.name IS NULL
)
ORDER BY C.date_fetch DESC
LIMIT :limit OFFSET :offset;
getScanlatorsByMangaId:
SELECT scanlator
FROM chapters