From d50646f955625d311fd9269bb91bc9c6f2aeb5e9 Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Thu, 19 Dec 2024 11:03:47 +0800 Subject: [PATCH] feat: sort series by random Closes: #1558 --- komga-webui/src/locales/en.json | 1 + komga-webui/src/views/BrowseLibraries.vue | 1 + .../org/gotson/komga/infrastructure/jooq/main/SeriesDtoDao.kt | 1 + 3 files changed, 3 insertions(+) diff --git a/komga-webui/src/locales/en.json b/komga-webui/src/locales/en.json index 1a1877bb..8b349ebc 100644 --- a/komga-webui/src/locales/en.json +++ b/komga-webui/src/locales/en.json @@ -973,6 +973,7 @@ "name": "Name", "number": "Number", "page_count": "Page count", + "random": "Random", "release_date": "Release date" }, "theme": { diff --git a/komga-webui/src/views/BrowseLibraries.vue b/komga-webui/src/views/BrowseLibraries.vue index b62462bd..d423f3e4 100644 --- a/komga-webui/src/views/BrowseLibraries.vue +++ b/komga-webui/src/views/BrowseLibraries.vue @@ -329,6 +329,7 @@ export default Vue.extend({ {name: this.$t('sort.release_date').toString(), key: 'booksMetadata.releaseDate'}, {name: this.$t('sort.folder_name').toString(), key: 'name'}, {name: this.$t('sort.books_count').toString(), key: 'booksCount'}, + {name: this.$t('sort.random').toString(), key: 'random'}, ] as SortOption[] }, filterOptionsList(): FiltersOptions { diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/main/SeriesDtoDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/main/SeriesDtoDao.kt index 93d5703c..6af28e4a 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/main/SeriesDtoDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/main/SeriesDtoDao.kt @@ -94,6 +94,7 @@ class SeriesDtoDao( "collection.number" to cs.NUMBER, "name" to s.NAME.collate(SqliteUdfDataSource.COLLATION_UNICODE_3), "booksCount" to s.BOOK_COUNT, + "random" to DSL.rand(), ) override fun findAll(pageable: Pageable): Page = findAll(SeriesSearch(), SearchContext.ofAnonymousUser(), pageable)