Moves upcoming requirement from existence to current day or later. (#606)

* Moves upcoming requirement from existence to current day or later.

* Suppress millis conversion warning
This commit is contained in:
Maddie Witman 2024-03-31 03:49:06 -04:00 committed by GitHub
parent 555d2f834f
commit c9fddf9e38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -10,6 +10,8 @@ import tachiyomi.domain.library.model.LibraryManga
import tachiyomi.domain.manga.model.Manga
import tachiyomi.domain.manga.model.MangaUpdate
import tachiyomi.domain.manga.repository.MangaRepository
import java.time.LocalDate
import java.time.ZoneId
class MangaRepositoryImpl(
private val handler: DatabaseHandler,
@ -65,9 +67,11 @@ class MangaRepositoryImpl(
}
}
@Suppress("MagicNumber")
override suspend fun getUpcomingManga(statuses: Set<Long>): Flow<List<Manga>> {
val epochMillis = LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toEpochSecond() * 1000
return handler.subscribeToList {
mangasQueries.getUpcomingManga(statuses, MangaMapper::mapManga)
mangasQueries.getUpcomingManga(epochMillis, statuses, MangaMapper::mapManga)
}
}

View File

@ -115,7 +115,7 @@ AND _id != :id;
getUpcomingManga:
SELECT *
FROM mangas
WHERE next_update > 0
WHERE next_update >= :startOfDay
AND favorite = 1
AND status IN :statuses
ORDER BY next_update ASC;