Skip to content

Commit

Permalink
Fix update only when chapter info changed (#935)
Browse files Browse the repository at this point in the history
fix: update only when info changed
  • Loading branch information
he0119 authored Feb 1, 2024
1 parent e0dbf87 commit 4bf6154
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/services/updates/LibraryUpdateQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,16 @@ const updateNovel = async (
novel.chapters?.forEach(chapter => {
const { name, url, releaseTime } = chapter;
tx.executeSql(
"INSERT INTO Chapter (url, name, releaseTime, novelId, updatedTime) values (?, ?, ?, ?, datetime('now','localtime')) ON CONFLICT(url) DO UPDATE SET name=excluded.name, releaseTime=excluded.releaseTime, novelId=excluded.novelId, updatedTime=excluded.updatedTime",
`
INSERT INTO Chapter (url, name, releaseTime, novelId, updatedTime)
VALUES (?, ?, ?, ?, datetime('now','localtime'))
ON CONFLICT(url) DO UPDATE SET
name=excluded.name,
releaseTime=excluded.releaseTime,
updatedTime=excluded.updatedTime
WHERE Chapter.name != excluded.name
OR Chapter.releaseTime != excluded.releaseTime;
`,
[url, name, releaseTime || '', novelId],
(txObj, { insertId }) => {
if (insertId && downloadNewChapters) {
Expand Down

0 comments on commit 4bf6154

Please sign in to comment.