move insert methods for issue history to the issue history code fold section

Sun, 14 Sep 2025 13:32:23 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 14 Sep 2025 13:32:23 +0200
changeset 382
f50f2f75fee5
parent 381
334e8fb88614
child 383
7f29f2f375e2

move insert methods for issue history to the issue history code fold section

src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt file | annotate | diff | comparison | revisions
--- a/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Sun Sep 14 13:17:54 2025 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Sun Sep 14 13:32:23 2025 +0200
@@ -977,37 +977,6 @@
         updateVariantStatus(issue.id, issue.variantStatus)
     }
 
-    override fun insertHistoryEvent(author: User?, issue: Issue, newId: Int) {
-        val type = if (newId > 0) IssueHistoryType.New else IssueHistoryType.Update
-        val issueid = if (newId > 0) newId else issue.id
-
-        val eventid =
-            withStatement("insert into lpit_issue_history_event(issueid, subject, type, userid) values (?,?,?::issue_history_event,?) returning eventid") {
-                setInt(1, issueid)
-                setString(2, issue.subject)
-                setEnum(3, type)
-                setIntOrNull(4, author?.id)
-                querySingle { it.getInt(1) }!!
-            }
-        withStatement(
-            """
-            insert into lpit_issue_history_data (component, status, category, description, assignee, eta, affected, resolved, eventid)
-            values (?, ?::issue_status, ?::issue_category, ?, ?, ?, ?, ?, ?)
-            """.trimIndent()
-        ) {
-            setStringOrNull(1, issue.component?.name)
-            setEnum(2, issue.status)
-            setEnum(3, issue.category)
-            setStringOrNull(4, issue.description)
-            setStringOrNull(5, issue.assignee?.shortDisplayname)
-            setDateOrNull(6, issue.eta)
-            setStringOrNull(7, issue.affected?.name)
-            setStringOrNull(8, issue.resolved?.name)
-            setInt(9, eventid)
-            executeUpdate()
-        }
-    }
-
     override fun listCommitRefs(issue: Issue): List<CommitRef> =
         withStatement("select commit_hash, commit_brief, commit_time from lpit_commit_ref where issueid = ? order by commit_time") {
             setInt(1, issue.id)
@@ -1137,7 +1106,39 @@
             }
         }
     }
+    //</editor-fold>
 
+    //<editor-fold desc="Issue History">
+    override fun insertHistoryEvent(author: User?, issue: Issue, newId: Int) {
+        val type = if (newId > 0) IssueHistoryType.New else IssueHistoryType.Update
+        val issueid = if (newId > 0) newId else issue.id
+
+        val eventid =
+            withStatement("insert into lpit_issue_history_event(issueid, subject, type, userid) values (?,?,?::issue_history_event,?) returning eventid") {
+                setInt(1, issueid)
+                setString(2, issue.subject)
+                setEnum(3, type)
+                setIntOrNull(4, author?.id)
+                querySingle { it.getInt(1) }!!
+            }
+        withStatement(
+            """
+            insert into lpit_issue_history_data (component, status, category, description, assignee, eta, affected, resolved, eventid)
+            values (?, ?::issue_status, ?::issue_category, ?, ?, ?, ?, ?, ?)
+            """.trimIndent()
+        ) {
+            setStringOrNull(1, issue.component?.name)
+            setEnum(2, issue.status)
+            setEnum(3, issue.category)
+            setStringOrNull(4, issue.description)
+            setStringOrNull(5, issue.assignee?.shortDisplayname)
+            setDateOrNull(6, issue.eta)
+            setStringOrNull(7, issue.affected?.name)
+            setStringOrNull(8, issue.resolved?.name)
+            setInt(9, eventid)
+            executeUpdate()
+        }
+    }
 
     override fun insertHistoryEvent(author: User?, issue: Issue, issueComment: IssueComment, newId: Int) {
         val type = if (newId > 0) IssueHistoryType.NewComment else IssueHistoryType.UpdateComment
@@ -1159,10 +1160,6 @@
         }
     }
 
-    //</editor-fold>
-
-    //<editor-fold desc="Issue History">
-
     override fun listIssueHistory(project: Project?, days: Int) =
         withStatement(
             """

mercurial