#164 add issue summary for developers

Thu, 29 Dec 2022 14:50:35 +0100

author
Mike Becker <universe@uap-core.de>
date
Thu, 29 Dec 2022 14:50:35 +0100
changeset 257
c1be672af7ff
parent 256
a7da88714dc3
child 258
564ae07a6def

#164 add issue summary for developers

src/main/kotlin/de/uapcore/lightpit/dao/DataAccessObject.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/entities/User.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/servlet/UsersServlet.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/viewmodel/Users.kt file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/changelogs/changelog-de.jspf file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/changelogs/changelog.jspf file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/users.jsp file | annotate | diff | comparison | revisions
--- a/src/main/kotlin/de/uapcore/lightpit/dao/DataAccessObject.kt	Thu Dec 29 14:03:00 2022 +0100
+++ b/src/main/kotlin/de/uapcore/lightpit/dao/DataAccessObject.kt	Thu Dec 29 14:50:35 2022 +0100
@@ -68,6 +68,7 @@
     fun updateProject(project: Project)
 
     fun collectIssueSummary(project: Project): IssueSummary
+    fun collectIssueSummary(assignee: User): IssueSummary
 
     fun listIssues(project: Project, version: Version?, component: Component?): List<Issue>
     fun findIssue(id: Int): Issue?
--- 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
+            }
+        }
+
     //</editor-fold>
 
     //<editor-fold desc="Issue">
--- a/src/main/kotlin/de/uapcore/lightpit/entities/User.kt	Thu Dec 29 14:03:00 2022 +0100
+++ b/src/main/kotlin/de/uapcore/lightpit/entities/User.kt	Thu Dec 29 14:50:35 2022 +0100
@@ -45,4 +45,4 @@
      * If neither given name nor lastname are provided, the username is used instead.
      */
     val displayname: String get() = if (mail.isNullOrBlank()) shortDisplayname else "$shortDisplayname <$mail>"
-}
\ No newline at end of file
+}
--- a/src/main/kotlin/de/uapcore/lightpit/servlet/UsersServlet.kt	Thu Dec 29 14:03:00 2022 +0100
+++ b/src/main/kotlin/de/uapcore/lightpit/servlet/UsersServlet.kt	Thu Dec 29 14:50:35 2022 +0100
@@ -32,6 +32,7 @@
 import de.uapcore.lightpit.dao.DataAccessObject
 import de.uapcore.lightpit.entities.User
 import de.uapcore.lightpit.viewmodel.UserEditView
+import de.uapcore.lightpit.viewmodel.UserViewData
 import de.uapcore.lightpit.viewmodel.UsersView
 import jakarta.servlet.annotation.WebServlet
 
@@ -50,7 +51,9 @@
 
     private fun index(http: HttpRequest, dao: DataAccessObject) {
         with(http) {
-            view = UsersView(dao.listUsers())
+            view = UsersView(dao.listUsers().map {
+                UserViewData(it, dao.collectIssueSummary(it))
+            })
             render(list)
         }
     }
--- a/src/main/kotlin/de/uapcore/lightpit/viewmodel/Users.kt	Thu Dec 29 14:03:00 2022 +0100
+++ b/src/main/kotlin/de/uapcore/lightpit/viewmodel/Users.kt	Thu Dec 29 14:50:35 2022 +0100
@@ -27,8 +27,13 @@
 
 import de.uapcore.lightpit.entities.User
 
+class UserViewData(
+    val user: User,
+    val issueSummary: IssueSummary
+)
+
 class UsersView(
-    val users: List<User>
+    val users: List<UserViewData>
 ) : View()
 
 class UserEditView(
--- a/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Thu Dec 29 14:03:00 2022 +0100
+++ b/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Thu Dec 29 14:50:35 2022 +0100
@@ -36,6 +36,7 @@
     <li>Spalte für zugewiesener Entwickler zu den Vorgangstabellen hinzugefügt.</li>
     <li>Spalte für den Zeitpunkt der letzten Aktualisierung zu den Vorgangstabellen hinzugefügt.</li>
     <li>E-Mail Link in Vorgangsansicht hinzugefügt, wenn der Zugewiesene eine Mailadresse hat.</li>
+    <li>Anzahl an zugewiesenen Vorgängen zur Übersichtstabelle der Entwickler hinzugefügt.</li>
     <li>Formatierung für Status-Icons hinzugefügt, die als Text eingegeben werden: (/), (x) sowie (!)</li>
     <li>Installationsanweisungen hinzugefügt.</li>
     <li>Unterstützung für Jakarta EE hinzugefügt und Laufzeitabhängigkeiten entfernt.</li>
--- a/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Thu Dec 29 14:03:00 2022 +0100
+++ b/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Thu Dec 29 14:50:35 2022 +0100
@@ -36,6 +36,7 @@
     <li>Add assignee to the issue overview tables.</li>
     <li>Add updated timestamp to the issue overview tables.</li>
     <li>Add mailto link in issue view when the assignee has a mail address.</li>
+    <li>Add issue summaries to developers table.</li>
     <li>Add formatting for (/), (x), and (!) status indicators.</li>
     <li>Add install instructions.</li>
     <li>Add Jakarta EE support and remove runtime dependencies.</li>
--- a/src/main/webapp/WEB-INF/jsp/users.jsp	Thu Dec 29 14:03:00 2022 +0100
+++ b/src/main/webapp/WEB-INF/jsp/users.jsp	Thu Dec 29 14:50:35 2022 +0100
@@ -42,17 +42,36 @@
 
 <c:if test="${not empty viewmodel.users}">
     <table class="datatable medskip">
+        <colgroup>
+            <col>
+            <col>
+            <col style="width: 12%">
+            <col style="width: 12%">
+            <col style="width: 12%">
+        </colgroup>
         <thead>
         <tr>
+            <th colspan="2"></th>
+            <th colspan="3" class="hcenter">
+                <fmt:message key="issues"/>
+            </th>
+        </tr>
+        <tr>
             <th></th>
             <th><fmt:message key="user.displayname"/></th>
+            <th class="hcenter"><fmt:message key="issues.open" /></th>
+            <th class="hcenter"><fmt:message key="issues.active" /></th>
+            <th class="hcenter"><fmt:message key="issues.done" /></th>
         </tr>
         </thead>
         <tbody>
-        <c:forEach var="user" items="${viewmodel.users}">
+        <c:forEach var="userdata" items="${viewmodel.users}">
             <tr>
-                <td><a href="./users/${user.id}/edit">&#x270e;</a></td>
-                <td><c:out value="${user.displayname}"/></td>
+                <td><a href="./users/${userdata.user.id}/edit">&#x270e;</a></td>
+                <td><c:out value="${userdata.user.displayname}"/></td>
+                <td class="hright">${userdata.issueSummary.open}</td>
+                <td class="hright">${userdata.issueSummary.active}</td>
+                <td class="hright">${userdata.issueSummary.done}</td>
             </tr>
         </c:forEach>
         </tbody>

mercurial