Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziedelth committed Feb 10, 2023
1 parent 41da14f commit 4bf1f5d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class EpisodeController(
try {
val watchlist = call.receive<String>()
val (page, limit) = getPageAndLimit()
println("POST $prefix/watchlist/page/$page/limit/$limit")
println("POST $prefix/watchlist_filter/page/$page/limit/$limit")
val dataFromGzip = Gson().fromJson(Decoder.fromGzip(watchlist), JsonObject::class.java)

val animes = dataFromGzip.getAsJsonArray("animes").map { UUID.fromString(it.asString) }
Expand Down
12 changes: 11 additions & 1 deletion src/main/kotlin/fr/ziedelth/repositories/EpisodeRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,20 @@ class EpisodeRepository(session: () -> Session = { Database.getSession() }) : Ab
page: Int,
limit: Int
): List<Episode> {
if (episodes.isEmpty())
return super.getByPage(
page,
limit,
"FROM Episode WHERE anime.uuid IN :animes AND episodeType.uuid IN :episodeTypes AND langType.uuid IN :langTypes $ORDER",
"animes" to animes,
"episodeTypes" to episodeTypes,
"langTypes" to langTypes
)

return super.getByPage(
page,
limit,
"FROM Episode WHERE anime.uuid IN :animes AND uuid NOT IN :episodes AND episodeType.uuid IN :episodeTypes AND langType.uuid IN :langTypes $ORDER",
"FROM Episode WHERE uuid NOT IN :episodes AND anime.uuid IN :animes AND episodeType.uuid IN :episodeTypes AND langType.uuid IN :langTypes $ORDER",
"animes" to animes,
"episodes" to episodes,
"episodeTypes" to episodeTypes,
Expand Down

0 comments on commit 4bf1f5d

Please sign in to comment.