fix(library): Accidentally swap global open random manga with non-global

This commit is contained in:
Ahmad Ansori Palembani 2024-11-29 13:13:21 +07:00
parent a4a7f8fb6d
commit cf06ebdb8b
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 8 additions and 2 deletions

View file

@ -521,9 +521,9 @@ open class LibraryController(
private fun openRandomManga(global: Boolean) {
val items = if (global) {
adapter.currentItems
} else {
presenter.allLibraryItems
} else {
adapter.currentItems
}.filter { (it is LibraryItem && !it.manga.isBlank() && !it.manga.isHidden() && (!it.manga.initialized || it.manga.unread > 0)) }
if (items.isNotEmpty()) {
val item = items.random() as LibraryItem

View file

@ -86,3 +86,9 @@ WHERE _id = :mangaId;
selectLastInsertedRowId:
SELECT last_insert_rowid();
deleteNotInLibraryAndNotReadBySourceIds:
DELETE FROM mangas
WHERE favorite = :favorite AND source IN :sourceIds AND _id NOT IN (
SELECT chapters.manga_id FROM chapters WHERE read = 1 OR last_page_read != 0
);