diff -r a7da88714dc3 -r c1be672af7ff src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt --- a/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt Thu Dec 29 14:03:00 2022 +0100 +++ b/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt Thu Dec 29 14:50:35 2022 +0100 @@ -444,6 +444,32 @@ } } + override fun collectIssueSummary(assignee: User): IssueSummary = + withStatement( + """ + select phase, count(*) as total + from lpit_issue + join lpit_issue_phases using(status) + where assignee = ? + group by phase + """.trimIndent() + ) { + setInt(1, assignee.id) + executeQuery().use { + val summary = IssueSummary() + while (it.next()) { + val phase = it.getInt("phase") + val total = it.getInt("total") + when (phase) { + 0 -> summary.open = total + 1 -> summary.active = total + 2 -> summary.done = total + } + } + summary + } + } + // //