mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-06-30 09:24:34 -05:00
Fix mangas query with active sorting and postgresql db (#2042)
fixes #2036
This commit is contained in:
@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
- (**Extension**) Do not indicate an update is available when the extension is not installed
|
||||
- (**Chapter**) Fix losing chapter data on failed chapter list update
|
||||
- (**Chapter**) Fix database error when fetching chapter updates
|
||||
- (**Manga/API**) Fix "mangas" graphql query with active sorting and using a postgresql database (QUERY "mangas")
|
||||
|
||||
## [v2.2.2100] + [WebUI: v20260508.01] - 2026-05-08
|
||||
|
||||
|
||||
@@ -247,11 +247,18 @@ class MangaQuery {
|
||||
MangaTable
|
||||
.leftJoin(CategoryMangaTable)
|
||||
.select(MangaTable.columns)
|
||||
.withDistinctOn(MangaTable.id)
|
||||
|
||||
val applySorting = order != null || orderBy != null || (last != null || before != null)
|
||||
|
||||
if (applySorting) {
|
||||
res.withDistinctOn(MangaTable.id to SortOrder.ASC)
|
||||
} else {
|
||||
res.withDistinctOn(MangaTable.id)
|
||||
}
|
||||
|
||||
res.applyOps(condition, filter)
|
||||
|
||||
if (order != null || orderBy != null || (last != null || before != null)) {
|
||||
if (applySorting) {
|
||||
val baseSort = listOf(MangaOrder(MangaOrderBy.ID, SortOrder.ASC))
|
||||
val deprecatedSort = listOfNotNull(orderBy?.let { MangaOrder(orderBy, orderByType) })
|
||||
val actualSort = (order.orEmpty() + deprecatedSort + baseSort)
|
||||
|
||||
Reference in New Issue
Block a user