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

changeset 227
f0ede8046b59
parent 225
87328572e36f
child 231
dcb1d5a7ea3a
     1.1 --- a/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Wed Aug 18 15:04:59 2021 +0200
     1.2 +++ b/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Wed Aug 18 15:30:49 2021 +0200
     1.3 @@ -249,7 +249,7 @@
     1.4      //language=SQL
     1.5      private val componentQuery =
     1.6          """
     1.7 -        select id, project, name, node, color, ordinal, description,
     1.8 +        select id, project, name, node, color, ordinal, description, active,
     1.9              userid, username, givenname, lastname, mail
    1.10          from lpit_component
    1.11          left join lpit_user on lead = userid
    1.12 @@ -266,6 +266,7 @@
    1.13              }
    1.14              ordinal = getInt("ordinal")
    1.15              description = getString("description")
    1.16 +            active = getBoolean("active")
    1.17              lead = extractOptionalUser()
    1.18          }
    1.19  
    1.20 @@ -277,6 +278,7 @@
    1.21              setStringSafe(i++, color.hex)
    1.22              setInt(i++, ordinal)
    1.23              setStringOrNull(i++, description)
    1.24 +            setBoolean(i++, active)
    1.25              setIntOrNull(i++, lead?.id)
    1.26              return i
    1.27          }
    1.28 @@ -302,13 +304,13 @@
    1.29                  from lpit_component c
    1.30                  left join issues i on c.id = i.component 
    1.31              )
    1.32 -            select c.id, project, name, node, color, ordinal, description,
    1.33 +            select c.id, project, name, node, color, ordinal, description, active,
    1.34                  userid, username, givenname, lastname, mail,
    1.35 -                open.total as open, active.total as active, done.total as done
    1.36 +                open.total as open, wip.total as wip, done.total as done
    1.37              from lpit_component c
    1.38              left join lpit_user on lead = userid
    1.39              left join summary open on c.id = open.id and open.phase = 0
    1.40 -            left join summary active on c.id = active.id and active.phase = 1
    1.41 +            left join summary wip on c.id = wip.id and wip.phase = 1
    1.42              left join summary done on c.id = done.id and done.phase = 2
    1.43              where c.project = ?
    1.44              order by ordinal, name
    1.45 @@ -318,7 +320,7 @@
    1.46              queryAll { rs ->
    1.47                  ComponentSummary(rs.extractComponent()).apply {
    1.48                      issueSummary.open = rs.getInt("open")
    1.49 -                    issueSummary.active = rs.getInt("active")
    1.50 +                    issueSummary.active = rs.getInt("wip")
    1.51                      issueSummary.done = rs.getInt("done")
    1.52                  }
    1.53              }
    1.54 @@ -338,7 +340,7 @@
    1.55          }
    1.56  
    1.57      override fun insertComponent(component: Component) {
    1.58 -        withStatement("insert into lpit_component (name, node, color, ordinal, description, lead, project) values (?, ?, ?, ?, ?, ?, ?)") {
    1.59 +        withStatement("insert into lpit_component (name, node, color, ordinal, description, active, lead, project) values (?, ?, ?, ?, ?, ?, ?, ?)") {
    1.60              val col = setComponent(1, component)
    1.61              setInt(col, component.projectid)
    1.62              executeUpdate()
    1.63 @@ -346,7 +348,7 @@
    1.64      }
    1.65  
    1.66      override fun updateComponent(component: Component) {
    1.67 -        withStatement("update lpit_component set name = ?, node = ?, color = ?, ordinal = ?, description = ?, lead = ? where id = ?") {
    1.68 +        withStatement("update lpit_component set name = ?, node = ?, color = ?, ordinal = ?, description = ?, active = ?, lead = ? where id = ?") {
    1.69              val col = setComponent(1, component)
    1.70              setInt(col, component.id)
    1.71              executeUpdate()

mercurial