Fix sorting on server

This commit is contained in:
Elena Lepilkina
2019-05-17 15:28:05 +03:00
parent 7c2eab9920
commit 36faec53e4
@@ -223,7 +223,8 @@ fun main(args: Array<String>) {
if (data !is JsonArray) {
error("Response is expected to be an array.")
}
val builds = data.jsonArray.map { Build.create(it as JsonObject) }.sortedBy { it.buildNumber.substringAfterLast("-") }
val builds = data.jsonArray.map { Build.create(it as JsonObject) }
.sortedWith(compareBy ( { it.buildNumber.substringBefore("-").toDouble() }, { it.buildNumber.substringAfterLast("-").toInt() }))
val branchesUrl = "$serverUrl/branches/${parameters["target"]}"