Skip to content

Commit

Permalink
fix: sorting info in reverse order
Browse files Browse the repository at this point in the history
  • Loading branch information
1grzyb1 committed Apr 1, 2024
1 parent b747b75 commit 41d8a78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion odyseja-ui/src/routes/panel/info/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
}
function mapInfosToTable(category: InfoCategory): TableSource {
let infos = data.infos.filter(info => info.categoryName === category.name);
let infos = data.infos.filter(info => info.categoryName === category.name).sort((a, b) => a.sortNumber - b.sortNumber);
return {
head: ['Nazwa'],
body: tableMapperValues(infos, ['infoName']),
Expand Down
5 changes: 3 additions & 2 deletions src/main/kotlin/odyseja/odysejapka/info/InfoService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ class InfoService(
) {

fun getInfo(city: Int): Iterable<Info?>? {
return infoRepository.findByCity(cityRepository.findFirstById(city)).map { it.toInfo() }.sortedBy { it.sortNumber }
return infoRepository.findByCity(cityRepository.findFirstById(city)).map { it.toInfo() }
.sortedByDescending { it.sortNumber }
}

fun getAllInfo(): List<Info> {
return infoRepository.findAllByOrderBySortNumber().map { it.toInfo() }.sortedBy { it.sortNumber }
return infoRepository.findAllByOrderBySortNumber().map { it.toInfo() }.sortedByDescending { it.sortNumber }
}

fun getInfoCategory(): MutableIterable<InfoCategoryEntity> {
Expand Down

0 comments on commit 41d8a78

Please sign in to comment.