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

changeset 257
c1be672af7ff
parent 248
90dc13c78b5d
child 260
fb2ae2d63a56
     1.1 --- a/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Thu Dec 29 14:03:00 2022 +0100
     1.2 +++ b/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Thu Dec 29 14:50:35 2022 +0100
     1.3 @@ -444,6 +444,32 @@
     1.4              }
     1.5          }
     1.6  
     1.7 +    override fun collectIssueSummary(assignee: User): IssueSummary =
     1.8 +        withStatement(
     1.9 +            """
    1.10 +            select phase, count(*) as total
    1.11 +            from lpit_issue
    1.12 +            join lpit_issue_phases using(status)
    1.13 +            where assignee = ?
    1.14 +            group by phase  
    1.15 +            """.trimIndent()
    1.16 +        ) {
    1.17 +            setInt(1, assignee.id)
    1.18 +            executeQuery().use {
    1.19 +                val summary = IssueSummary()
    1.20 +                while (it.next()) {
    1.21 +                    val phase = it.getInt("phase")
    1.22 +                    val total = it.getInt("total")
    1.23 +                    when (phase) {
    1.24 +                        0 -> summary.open = total
    1.25 +                        1 -> summary.active = total
    1.26 +                        2 -> summary.done = total
    1.27 +                    }
    1.28 +                }
    1.29 +                summary
    1.30 +            }
    1.31 +        }
    1.32 +
    1.33      //</editor-fold>
    1.34  
    1.35      //<editor-fold desc="Issue">

mercurial