diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-03-07 02:36:16 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-03-07 02:36:16 +0100 |
commit | 36769560e967bc99cee37e93bf74897f06aa727f (patch) | |
tree | 7fac0a8123ad116a9dc20947f1e2ca6a9accafe2 | |
parent | 71d42f443fed78bc3164fa6ff6a3e87f640166ea (diff) | |
download | SkyHanniChangelogBuilder-36769560e967bc99cee37e93bf74897f06aa727f.tar.gz SkyHanniChangelogBuilder-36769560e967bc99cee37e93bf74897f06aa727f.tar.bz2 SkyHanniChangelogBuilder-36769560e967bc99cee37e93bf74897f06aa727f.zip |
fixed sorting bug
-rw-r--r-- | src/main/kotlin/Main.kt | 13 |
1 files 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<String> { } 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 { |