fixes insertVersionInfo not using inserted issue id

Tue, 06 Apr 2021 09:08:54 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 06 Apr 2021 09:08:54 +0200
changeset 188
2979436edd9e
parent 187
0bf35031a918
child 189
f7de8158b41c

fixes insertVersionInfo not using inserted issue id

src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt file | annotate | diff | comparison | revisions
--- a/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Mon Apr 05 17:56:46 2021 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Tue Apr 06 09:08:54 2021 +0200
@@ -764,9 +764,9 @@
         return selectIssues(stmtFindIssueByID).firstOrNull()
     }
 
-    private fun insertVersionInfo(issue: Issue) {
-        stmtInsertAffectedVersion.setInt(1, issue.id)
-        stmtInsertResolvedVersion.setInt(1, issue.id)
+    private fun insertVersionInfo(id: Int, issue: Issue) {
+        stmtInsertAffectedVersion.setInt(1, id)
+        stmtInsertResolvedVersion.setInt(1, id)
         issue.affectedVersions.forEach {
             stmtInsertAffectedVersion.setInt(2, it.id)
             stmtInsertAffectedVersion.execute()
@@ -784,7 +784,7 @@
             rs.next()
             rs.getInt(1)
         }
-        insertVersionInfo(issue)
+        insertVersionInfo(id, issue)
         return id
     }
 
@@ -797,7 +797,7 @@
         stmtClearResolvedVersions.setInt(1, issue.id)
         stmtClearAffectedVersions.execute()
         stmtClearResolvedVersions.execute()
-        insertVersionInfo(issue)
+        insertVersionInfo(issue.id, issue)
     }
 
     //</editor-fold>

mercurial