src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt

changeset 231
dcb1d5a7ea3a
parent 227
f0ede8046b59
child 232
296e12ff8d1c
--- a/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt	Wed Aug 18 16:02:40 2021 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt	Thu Aug 19 14:51:04 2021 +0200
@@ -482,9 +482,9 @@
                 // pre-select version, if available in the path info
                 if (version != null) {
                     if (version.status.isReleased) {
-                        issue.affectedVersions = listOf(version)
+                        issue.affected = version
                     } else {
-                        issue.resolvedVersions = listOf(version)
+                        issue.resolved = version
                     }
                 }
             }
@@ -565,10 +565,8 @@
                 // TODO: process error messages
                 eta = http.param("eta", ::dateOptValidator, null, mutableListOf())
 
-                affectedVersions = http.paramArray("affected")
-                    .mapNotNull { param -> param.toIntOrNull()?.let { Version(it, project.id) } }
-                resolvedVersions = http.paramArray("resolved")
-                    .mapNotNull { param -> param.toIntOrNull()?.let { Version(it, project.id) } }
+                affected = http.param("affected")?.toIntOrNull()?.takeIf { it > 0 }?.let { Version(it, project.id) }
+                resolved = http.param("resolved")?.toIntOrNull()?.takeIf { it > 0 }?.let { Version(it, project.id) }
             }
 
             val openId = if (issue.id < 0) {

mercurial