From 36769560e967bc99cee37e93bf74897f06aa727f Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 7 Mar 2024 02:36:16 +0100 Subject: fixed sorting bug --- src/main/kotlin/Main.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt index 1f43b70..a472205 100644 --- a/src/main/kotlin/Main.kt +++ b/src/main/kotlin/Main.kt @@ -4,6 +4,7 @@ import com.google.gson.GsonBuilder import com.google.gson.JsonArray import java.net.URL +import java.time.Instant import java.util.regex.Matcher import java.util.regex.Pattern import kotlin.system.exitProcess @@ -31,9 +32,9 @@ fun getTextFromUrl(urlString: String): List { } fun main() { - val firstPr = 1106 + val firstPr = 1112 val hideWhenError = true - val title = "Version 0.24 Beta 5" + val title = "Version 0.24 Beta 6" println("") val url = @@ -126,12 +127,14 @@ private fun findAllChanges( ) { var errors = 0 var done = 0 - for (pr in prs) { + + // TODO find better solution for this sorting logic + for (pr in prs.filter { it.closedAt != null } + .map { it to Long.MAX_VALUE - Instant.parse(it.closedAt).toEpochMilli() } + .sortedBy { it.second }.map { it.first }) { val number = pr.number val prLink = pr.htmlUrl val body = pr.body - val merged = pr.mergedAt != null - if (!merged) continue val description = body?.split(System.lineSeparator()) ?: emptyList() try { -- cgit