Skip to content

Commit

Permalink
Moves upcoming requirement from existence to current day or later. (#606
Browse files Browse the repository at this point in the history
)

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

* Suppress millis conversion warning
  • Loading branch information
sirlag authored Mar 31, 2024
1 parent 555d2f8 commit c9fddf9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion data/src/main/sqldelight/tachiyomi/data/mangas.sq
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c9fddf9

Please sign in to comment.