mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix: Don't group result by manga id (GH-83)
This commit is contained in:
parent
81cfc53589
commit
df507b6a41
2 changed files with 38 additions and 2 deletions
37
app/src/main/sqldelight/tachiyomi/migrations/21.sqm
Normal file
37
app/src/main/sqldelight/tachiyomi/migrations/21.sqm
Normal file
|
@ -0,0 +1,37 @@
|
|||
DROP VIEW IF EXISTS library_view;
|
||||
CREATE VIEW library_view AS
|
||||
SELECT
|
||||
M.*,
|
||||
coalesce(C.total, 0) AS total,
|
||||
coalesce(C.read_count, 0) AS has_read,
|
||||
coalesce(C.bookmark_count, 0) AS bookmark_count,
|
||||
coalesce(MC.category_id, 0) AS category
|
||||
FROM mangas AS M
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
chapters.manga_id,
|
||||
count(*) AS total,
|
||||
sum(read) AS read_count,
|
||||
sum(bookmark) AS bookmark_count
|
||||
FROM chapters
|
||||
LEFT JOIN (
|
||||
WITH RECURSIVE split(seq, _id, name, str) AS ( -- Probably should migrate this to its own table someday
|
||||
SELECT 0, mangas._id, NULL, replace(ifnull(mangas.filtered_scanlators, ''), ' & ', '[.]')||'[.]' FROM mangas
|
||||
UNION ALL SELECT
|
||||
seq+1,
|
||||
_id,
|
||||
substr(str, 0, instr(str, '[.]')),
|
||||
substr(str, instr(str, '[.]')+3)
|
||||
FROM split WHERE str != ''
|
||||
) SELECT _id, name FROM split WHERE split.seq != 0 ORDER BY split.seq ASC
|
||||
) AS filtered_scanlators
|
||||
ON chapters.manga_id = filtered_scanlators._id
|
||||
AND ifnull(chapters.scanlator, 'N/A') = ifnull(filtered_scanlators.name, '/<INVALID>/') -- I assume if it's N/A it shouldn't be filtered
|
||||
WHERE filtered_scanlators.name IS NULL
|
||||
GROUP BY chapters.manga_id
|
||||
) AS C
|
||||
ON M._id = C.manga_id
|
||||
LEFT JOIN (SELECT * FROM mangas_categories) AS MC
|
||||
ON MC.manga_id = M._id
|
||||
WHERE M.favorite = 1
|
||||
ORDER BY M.title;
|
|
@ -30,10 +30,9 @@ LEFT JOIN (
|
|||
GROUP BY chapters.manga_id
|
||||
) AS C
|
||||
ON M._id = C.manga_id
|
||||
LEFT JOIN mangas_categories AS MC
|
||||
LEFT JOIN (SELECT * FROM mangas_categories) AS MC
|
||||
ON MC.manga_id = M._id
|
||||
WHERE M.favorite = 1
|
||||
GROUP BY M._id
|
||||
ORDER BY M.title;
|
||||
|
||||
findAll:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue