mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-06-30 17:34:39 -05:00
fix sorting
This commit is contained in:
@@ -11,7 +11,7 @@ import eu.kanade.tachiyomi.source.model.SChapter
|
|||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.util.chapter.ChapterRecognition
|
import eu.kanade.tachiyomi.util.chapter.ChapterRecognition
|
||||||
import org.jetbrains.exposed.dao.id.EntityID
|
import org.jetbrains.exposed.dao.id.EntityID
|
||||||
import org.jetbrains.exposed.sql.SortOrder.DESC
|
import org.jetbrains.exposed.sql.SortOrder
|
||||||
import org.jetbrains.exposed.sql.and
|
import org.jetbrains.exposed.sql.and
|
||||||
import org.jetbrains.exposed.sql.deleteWhere
|
import org.jetbrains.exposed.sql.deleteWhere
|
||||||
import org.jetbrains.exposed.sql.insert
|
import org.jetbrains.exposed.sql.insert
|
||||||
@@ -41,7 +41,7 @@ object Chapter {
|
|||||||
getSourceChapters(mangaId)
|
getSourceChapters(mangaId)
|
||||||
} else {
|
} else {
|
||||||
transaction {
|
transaction {
|
||||||
ChapterTable.select { ChapterTable.manga eq mangaId }.orderBy(ChapterTable.sourceOrder to DESC)
|
ChapterTable.select { ChapterTable.manga eq mangaId }.orderBy(ChapterTable.sourceOrder to SortOrder.DESC)
|
||||||
.map {
|
.map {
|
||||||
ChapterTable.toDataClass(it)
|
ChapterTable.toDataClass(it)
|
||||||
}
|
}
|
||||||
@@ -322,18 +322,15 @@ object Chapter {
|
|||||||
|
|
||||||
fun getRecentChapters(): List<MangaChapterDataClass> {
|
fun getRecentChapters(): List<MangaChapterDataClass> {
|
||||||
return transaction {
|
return transaction {
|
||||||
val x = (ChapterTable innerJoin MangaTable)
|
(ChapterTable innerJoin MangaTable)
|
||||||
// .selectAll()
|
|
||||||
.select { (MangaTable.inLibrary eq true) and (ChapterTable.fetchedAt greater MangaTable.inLibraryAt) }
|
.select { (MangaTable.inLibrary eq true) and (ChapterTable.fetchedAt greater MangaTable.inLibraryAt) }
|
||||||
|
.orderBy(ChapterTable.fetchedAt to SortOrder.DESC)
|
||||||
println(x.count())
|
.map {
|
||||||
|
MangaChapterDataClass(
|
||||||
x.map {
|
MangaTable.toDataClass(it),
|
||||||
MangaChapterDataClass(
|
ChapterTable.toDataClass(it)
|
||||||
MangaTable.toDataClass(it),
|
)
|
||||||
ChapterTable.toDataClass(it)
|
}
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user