mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-28 04:47:56 +01:00
Reader: Save reading progress with SQLDelight (#7185)
* Use SQLDelight in reader to update history * Move chapter progress to sqldelight * Review Changes Co-Authored-By: inorichi <len@kanade.eu> * Review Changes 2 Co-authored-by: FourTOne5 <59261191+FourTOne5@users.noreply.github.com> Co-authored-by: inorichi <len@kanade.eu>
This commit is contained in:
@@ -1,24 +1,25 @@
|
||||
CREATE VIEW historyView AS
|
||||
SELECT
|
||||
history.history_id AS id,
|
||||
mangas._id AS mangaId,
|
||||
chapters._id AS chapterId,
|
||||
mangas.title,
|
||||
mangas.thumbnail_url AS thumnailUrl,
|
||||
chapters.chapter_number AS chapterNumber,
|
||||
history.history_last_read AS readAt,
|
||||
max_last_read.history_last_read AS maxReadAt,
|
||||
max_last_read.history_chapter_id AS maxReadAtChapterId
|
||||
history._id AS id,
|
||||
mangas._id AS mangaId,
|
||||
chapters._id AS chapterId,
|
||||
mangas.title,
|
||||
mangas.thumbnail_url AS thumbnailUrl,
|
||||
chapters.chapter_number AS chapterNumber,
|
||||
history.last_read AS readAt,
|
||||
history.time_read AS readDuration,
|
||||
max_last_read.last_read AS maxReadAt,
|
||||
max_last_read.chapter_id AS maxReadAtChapterId
|
||||
FROM mangas
|
||||
JOIN chapters
|
||||
ON mangas._id = chapters.manga_id
|
||||
JOIN history
|
||||
ON chapters._id = history.history_chapter_id
|
||||
ON chapters._id = history.chapter_id
|
||||
JOIN (
|
||||
SELECT chapters.manga_id,chapters._id AS history_chapter_id, MAX(history.history_last_read) AS history_last_read
|
||||
FROM chapters JOIN history
|
||||
ON chapters._id = history.history_chapter_id
|
||||
GROUP BY chapters.manga_id
|
||||
SELECT chapters.manga_id,chapters._id AS chapter_id, MAX(history.last_read) AS last_read
|
||||
FROM chapters JOIN history
|
||||
ON chapters._id = history.chapter_id
|
||||
GROUP BY chapters.manga_id
|
||||
) AS max_last_read
|
||||
ON chapters.manga_id = max_last_read.manga_id;
|
||||
|
||||
@@ -35,9 +36,10 @@ id,
|
||||
mangaId,
|
||||
chapterId,
|
||||
title,
|
||||
thumnailUrl,
|
||||
thumbnailUrl,
|
||||
chapterNumber,
|
||||
readAt
|
||||
readAt,
|
||||
readDuration
|
||||
FROM historyView
|
||||
WHERE historyView.readAt > 0
|
||||
AND maxReadAtChapterId = historyView.chapterId
|
||||
|
||||
Reference in New Issue
Block a user