mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 20:31:02 -05:00
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:
parent
555d2f834f
commit
c9fddf9e38
2 changed files with 6 additions and 2 deletions
|
@ -10,6 +10,8 @@ import tachiyomi.domain.library.model.LibraryManga
|
||||||
import tachiyomi.domain.manga.model.Manga
|
import tachiyomi.domain.manga.model.Manga
|
||||||
import tachiyomi.domain.manga.model.MangaUpdate
|
import tachiyomi.domain.manga.model.MangaUpdate
|
||||||
import tachiyomi.domain.manga.repository.MangaRepository
|
import tachiyomi.domain.manga.repository.MangaRepository
|
||||||
|
import java.time.LocalDate
|
||||||
|
import java.time.ZoneId
|
||||||
|
|
||||||
class MangaRepositoryImpl(
|
class MangaRepositoryImpl(
|
||||||
private val handler: DatabaseHandler,
|
private val handler: DatabaseHandler,
|
||||||
|
@ -65,9 +67,11 @@ class MangaRepositoryImpl(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("MagicNumber")
|
||||||
override suspend fun getUpcomingManga(statuses: Set<Long>): Flow<List<Manga>> {
|
override suspend fun getUpcomingManga(statuses: Set<Long>): Flow<List<Manga>> {
|
||||||
|
val epochMillis = LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toEpochSecond() * 1000
|
||||||
return handler.subscribeToList {
|
return handler.subscribeToList {
|
||||||
mangasQueries.getUpcomingManga(statuses, MangaMapper::mapManga)
|
mangasQueries.getUpcomingManga(epochMillis, statuses, MangaMapper::mapManga)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ AND _id != :id;
|
||||||
getUpcomingManga:
|
getUpcomingManga:
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM mangas
|
FROM mangas
|
||||||
WHERE next_update > 0
|
WHERE next_update >= :startOfDay
|
||||||
AND favorite = 1
|
AND favorite = 1
|
||||||
AND status IN :statuses
|
AND status IN :statuses
|
||||||
ORDER BY next_update ASC;
|
ORDER BY next_update ASC;
|
||||||
|
|
Loading…
Reference in a new issue