#156 fixes auto-selection overriding issue data

Mon, 09 Aug 2021 16:25:50 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 09 Aug 2021 16:25:50 +0200
changeset 215
028792eda9b7
parent 214
69647ddb57f2
child 216
6357d2fd84f2

#156 fixes auto-selection overriding issue data

src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt file | annotate | diff | comparison | revisions
--- a/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Mon Aug 09 16:22:56 2021 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Mon Aug 09 16:25:50 2021 +0200
@@ -484,6 +484,7 @@
             eta = getDate("eta")
         }
 
+        //language=SQL
         fun versionQuery(table: String) =
             """
             select versionid, project, name, status, ordinal, node
--- a/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt	Mon Aug 09 16:22:56 2021 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt	Mon Aug 09 16:25:50 2021 +0200
@@ -460,15 +460,18 @@
                 project,
             )
 
-            // pre-select component, if available in the path info
-            issue.component = component
+            // for new issues set some defaults
+            if (issue.id < 0) {
+                // pre-select component, if available in the path info
+                issue.component = component
 
-            // pre-select version, if available in the path info
-            if (version != null) {
-                if (version.status.isReleased) {
-                    issue.affectedVersions = listOf(version)
-                } else {
-                    issue.resolvedVersions = listOf(version)
+                // pre-select version, if available in the path info
+                if (version != null) {
+                    if (version.status.isReleased) {
+                        issue.affectedVersions = listOf(version)
+                    } else {
+                        issue.resolvedVersions = listOf(version)
+                    }
                 }
             }
 

mercurial