fix: Include Imported Entries in “Downloaded Only” Mode (Closes #1261)

This commit is contained in:
Rajarshee Chatterjee
2025-10-21 15:20:34 +05:30
parent baabc073f0
commit 45174af3c2
4 changed files with 5 additions and 4 deletions
+1 -2
View File
@@ -1,4 +1,3 @@
import { LibraryFilter } from '@screens/library/constants/constants';
import { LibraryNovelInfo, NovelInfo } from '../types';
import { getAllSync } from '../utils/helpers';
@@ -15,7 +14,7 @@ export const getLibraryNovelsFromDb = (
}
if (downloadedOnlyMode) {
query += ` ${LibraryFilter.DownloadedOnly}`;
query += ` AND (chaptersDownloaded = 1 OR isLocal = 1)`;
}
if (searchText) {
+1
View File
@@ -38,6 +38,7 @@ BEGIN
UPDATE Novel
SET
totalChapters = (SELECT COUNT(*) FROM Chapter WHERE Chapter.novelId = Novel.id),
chaptersDownloaded = (SELECT COUNT(*) FROM Chapter WHERE Chapter.novelId = Novel.id AND Chapter.isDownloaded = 1),
chaptersUnread = (SELECT COUNT(*) FROM Chapter WHERE Chapter.novelId = Novel.id AND Chapter.unread = 1),
lastUpdatedAt = (SELECT MAX(updatedTime) FROM Chapter WHERE Chapter.novelId = Novel.id)
WHERE id = NEW.novelId;
+1 -1
View File
@@ -1,7 +1,7 @@
import { getString } from '@strings/translations';
export enum LibraryFilter {
Downloaded = 'chaptersDownloaded > 0',
Downloaded = '(chaptersDownloaded > 0 OR isLocal = 1)',
Unread = 'lastReadAt IS NULL',
Completed = "status LIKE 'Completed'",
DownloadedOnly = 'AND chaptersDownloaded > 0',
+2 -1
View File
@@ -75,12 +75,13 @@ const insertLocalChapter = async (
releaseTime: string,
) => {
const insertedChapter = await db.runAsync(
'INSERT INTO Chapter(novelId, name, path, releaseTime, position) VALUES(?, ?, ?, ?, ?)',
'INSERT INTO Chapter(novelId, name, path, releaseTime, position, isDownloaded) VALUES(?, ?, ?, ?, ?, ?)',
novelId,
name,
NOVEL_STORAGE + '/local/' + novelId + '/' + fakeId,
releaseTime,
fakeId,
1,
);
if (insertedChapter.lastInsertRowId && insertedChapter.lastInsertRowId >= 0) {
let chapterText: string = '';