src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt

changeset 227
f0ede8046b59
parent 225
87328572e36f
child 231
dcb1d5a7ea3a
--- a/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Wed Aug 18 15:04:59 2021 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Wed Aug 18 15:30:49 2021 +0200
@@ -249,7 +249,7 @@
     //language=SQL
     private val componentQuery =
         """
-        select id, project, name, node, color, ordinal, description,
+        select id, project, name, node, color, ordinal, description, active,
             userid, username, givenname, lastname, mail
         from lpit_component
         left join lpit_user on lead = userid
@@ -266,6 +266,7 @@
             }
             ordinal = getInt("ordinal")
             description = getString("description")
+            active = getBoolean("active")
             lead = extractOptionalUser()
         }
 
@@ -277,6 +278,7 @@
             setStringSafe(i++, color.hex)
             setInt(i++, ordinal)
             setStringOrNull(i++, description)
+            setBoolean(i++, active)
             setIntOrNull(i++, lead?.id)
             return i
         }
@@ -302,13 +304,13 @@
                 from lpit_component c
                 left join issues i on c.id = i.component 
             )
-            select c.id, project, name, node, color, ordinal, description,
+            select c.id, project, name, node, color, ordinal, description, active,
                 userid, username, givenname, lastname, mail,
-                open.total as open, active.total as active, done.total as done
+                open.total as open, wip.total as wip, done.total as done
             from lpit_component c
             left join lpit_user on lead = userid
             left join summary open on c.id = open.id and open.phase = 0
-            left join summary active on c.id = active.id and active.phase = 1
+            left join summary wip on c.id = wip.id and wip.phase = 1
             left join summary done on c.id = done.id and done.phase = 2
             where c.project = ?
             order by ordinal, name
@@ -318,7 +320,7 @@
             queryAll { rs ->
                 ComponentSummary(rs.extractComponent()).apply {
                     issueSummary.open = rs.getInt("open")
-                    issueSummary.active = rs.getInt("active")
+                    issueSummary.active = rs.getInt("wip")
                     issueSummary.done = rs.getInt("done")
                 }
             }
@@ -338,7 +340,7 @@
         }
 
     override fun insertComponent(component: Component) {
-        withStatement("insert into lpit_component (name, node, color, ordinal, description, lead, project) values (?, ?, ?, ?, ?, ?, ?)") {
+        withStatement("insert into lpit_component (name, node, color, ordinal, description, active, lead, project) values (?, ?, ?, ?, ?, ?, ?, ?)") {
             val col = setComponent(1, component)
             setInt(col, component.projectid)
             executeUpdate()
@@ -346,7 +348,7 @@
     }
 
     override fun updateComponent(component: Component) {
-        withStatement("update lpit_component set name = ?, node = ?, color = ?, ordinal = ?, description = ?, lead = ? where id = ?") {
+        withStatement("update lpit_component set name = ?, node = ?, color = ?, ordinal = ?, description = ?, active = ?, lead = ? where id = ?") {
             val col = setComponent(1, component)
             setInt(col, component.id)
             executeUpdate()

mercurial