Display total chapters on duplicates list items (#1963)

This commit is contained in:
NarwhalHorns
2025-04-07 18:33:49 +01:00
committed by GitHub
parent c1225a5ef9
commit 12abd9938b
11 changed files with 146 additions and 29 deletions

View File

@@ -116,11 +116,33 @@ WHERE favorite = 1
AND source = :sourceId;
getDuplicateLibraryManga:
SELECT *
FROM mangas
WHERE favorite = 1
AND lower(title) LIKE '%' || lower(:title) || '%'
AND _id != :id;
WITH
duplicates AS (
SELECT *
FROM mangas
WHERE favorite = 1
AND _id != :id
AND lower(title) LIKE '%' || lower(:title) || '%'
),
chapter_counts AS (
SELECT
M._id AS manga_id,
count(*) AS chapter_count
FROM duplicates M
JOIN chapters C
ON M._id = C.manga_id
LEFT JOIN excluded_scanlators ES
ON C.manga_id = ES.manga_id
AND C.scanlator = ES.scanlator
WHERE ES.scanlator IS NULL
GROUP BY M._id
)
SELECT
M.*,
coalesce(CC.chapter_count, 0) AS chapter_count
FROM duplicates M
LEFT JOIN chapter_counts CC
ON M._id = CC.manga_id;
getUpcomingManga:
SELECT *