Skip to content

Commit

Permalink
Added descending sorting to CaCApi
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyde committed Jul 21, 2024
1 parent 7460e0e commit 2e6a266
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,14 @@ suspend fun ClubAndCountyApi.Companion.get():ClubAndCountyApi {
)
resultList.add(Pair(timestamp.toLocalDateTime().toLocalDate(),deo))
}
val results = resultList.groupBy { it.first }.map {
val valueOnly =it.value.map { it -> it.second }
DateTimeFormatter.ISO_DATE.format(it.key) to valueOnly
}.toMap()
val results = resultList
.sortedByDescending { it.first }
.groupBy { it.first }
.map {
val valueOnly =it.value.map { it -> it.second }
DateTimeFormatter.ISO_DATE.format(it.key) to valueOnly
}.
toMap()
ClubAndCountyApi(results, listOf())

}?: ClubAndCountyApi(mapOf(), listOf())
Expand Down

0 comments on commit 2e6a266

Please sign in to comment.