#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
     1.1 --- a/src/main/kotlin/de/uapcore/lightpit/dao/DataAccessObject.kt	Thu Dec 29 14:03:00 2022 +0100
     1.2 +++ b/src/main/kotlin/de/uapcore/lightpit/dao/DataAccessObject.kt	Thu Dec 29 14:50:35 2022 +0100
     1.3 @@ -68,6 +68,7 @@
     1.4      fun updateProject(project: Project)
     1.5  
     1.6      fun collectIssueSummary(project: Project): IssueSummary
     1.7 +    fun collectIssueSummary(assignee: User): IssueSummary
     1.8  
     1.9      fun listIssues(project: Project, version: Version?, component: Component?): List<Issue>
    1.10      fun findIssue(id: Int): Issue?
     2.1 --- a/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Thu Dec 29 14:03:00 2022 +0100
     2.2 +++ b/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Thu Dec 29 14:50:35 2022 +0100
     2.3 @@ -444,6 +444,32 @@
     2.4              }
     2.5          }
     2.6  
     2.7 +    override fun collectIssueSummary(assignee: User): IssueSummary =
     2.8 +        withStatement(
     2.9 +            """
    2.10 +            select phase, count(*) as total
    2.11 +            from lpit_issue
    2.12 +            join lpit_issue_phases using(status)
    2.13 +            where assignee = ?
    2.14 +            group by phase  
    2.15 +            """.trimIndent()
    2.16 +        ) {
    2.17 +            setInt(1, assignee.id)
    2.18 +            executeQuery().use {
    2.19 +                val summary = IssueSummary()
    2.20 +                while (it.next()) {
    2.21 +                    val phase = it.getInt("phase")
    2.22 +                    val total = it.getInt("total")
    2.23 +                    when (phase) {
    2.24 +                        0 -> summary.open = total
    2.25 +                        1 -> summary.active = total
    2.26 +                        2 -> summary.done = total
    2.27 +                    }
    2.28 +                }
    2.29 +                summary
    2.30 +            }
    2.31 +        }
    2.32 +
    2.33      //</editor-fold>
    2.34  
    2.35      //<editor-fold desc="Issue">
     3.1 --- a/src/main/kotlin/de/uapcore/lightpit/entities/User.kt	Thu Dec 29 14:03:00 2022 +0100
     3.2 +++ b/src/main/kotlin/de/uapcore/lightpit/entities/User.kt	Thu Dec 29 14:50:35 2022 +0100
     3.3 @@ -45,4 +45,4 @@
     3.4       * If neither given name nor lastname are provided, the username is used instead.
     3.5       */
     3.6      val displayname: String get() = if (mail.isNullOrBlank()) shortDisplayname else "$shortDisplayname <$mail>"
     3.7 -}
     3.8 \ No newline at end of file
     3.9 +}
     4.1 --- a/src/main/kotlin/de/uapcore/lightpit/servlet/UsersServlet.kt	Thu Dec 29 14:03:00 2022 +0100
     4.2 +++ b/src/main/kotlin/de/uapcore/lightpit/servlet/UsersServlet.kt	Thu Dec 29 14:50:35 2022 +0100
     4.3 @@ -32,6 +32,7 @@
     4.4  import de.uapcore.lightpit.dao.DataAccessObject
     4.5  import de.uapcore.lightpit.entities.User
     4.6  import de.uapcore.lightpit.viewmodel.UserEditView
     4.7 +import de.uapcore.lightpit.viewmodel.UserViewData
     4.8  import de.uapcore.lightpit.viewmodel.UsersView
     4.9  import jakarta.servlet.annotation.WebServlet
    4.10  
    4.11 @@ -50,7 +51,9 @@
    4.12  
    4.13      private fun index(http: HttpRequest, dao: DataAccessObject) {
    4.14          with(http) {
    4.15 -            view = UsersView(dao.listUsers())
    4.16 +            view = UsersView(dao.listUsers().map {
    4.17 +                UserViewData(it, dao.collectIssueSummary(it))
    4.18 +            })
    4.19              render(list)
    4.20          }
    4.21      }
     5.1 --- a/src/main/kotlin/de/uapcore/lightpit/viewmodel/Users.kt	Thu Dec 29 14:03:00 2022 +0100
     5.2 +++ b/src/main/kotlin/de/uapcore/lightpit/viewmodel/Users.kt	Thu Dec 29 14:50:35 2022 +0100
     5.3 @@ -27,8 +27,13 @@
     5.4  
     5.5  import de.uapcore.lightpit.entities.User
     5.6  
     5.7 +class UserViewData(
     5.8 +    val user: User,
     5.9 +    val issueSummary: IssueSummary
    5.10 +)
    5.11 +
    5.12  class UsersView(
    5.13 -    val users: List<User>
    5.14 +    val users: List<UserViewData>
    5.15  ) : View()
    5.16  
    5.17  class UserEditView(
     6.1 --- a/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Thu Dec 29 14:03:00 2022 +0100
     6.2 +++ b/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Thu Dec 29 14:50:35 2022 +0100
     6.3 @@ -36,6 +36,7 @@
     6.4      <li>Spalte für zugewiesener Entwickler zu den Vorgangstabellen hinzugefügt.</li>
     6.5      <li>Spalte für den Zeitpunkt der letzten Aktualisierung zu den Vorgangstabellen hinzugefügt.</li>
     6.6      <li>E-Mail Link in Vorgangsansicht hinzugefügt, wenn der Zugewiesene eine Mailadresse hat.</li>
     6.7 +    <li>Anzahl an zugewiesenen Vorgängen zur Übersichtstabelle der Entwickler hinzugefügt.</li>
     6.8      <li>Formatierung für Status-Icons hinzugefügt, die als Text eingegeben werden: (/), (x) sowie (!)</li>
     6.9      <li>Installationsanweisungen hinzugefügt.</li>
    6.10      <li>Unterstützung für Jakarta EE hinzugefügt und Laufzeitabhängigkeiten entfernt.</li>
     7.1 --- a/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Thu Dec 29 14:03:00 2022 +0100
     7.2 +++ b/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Thu Dec 29 14:50:35 2022 +0100
     7.3 @@ -36,6 +36,7 @@
     7.4      <li>Add assignee to the issue overview tables.</li>
     7.5      <li>Add updated timestamp to the issue overview tables.</li>
     7.6      <li>Add mailto link in issue view when the assignee has a mail address.</li>
     7.7 +    <li>Add issue summaries to developers table.</li>
     7.8      <li>Add formatting for (/), (x), and (!) status indicators.</li>
     7.9      <li>Add install instructions.</li>
    7.10      <li>Add Jakarta EE support and remove runtime dependencies.</li>
     8.1 --- a/src/main/webapp/WEB-INF/jsp/users.jsp	Thu Dec 29 14:03:00 2022 +0100
     8.2 +++ b/src/main/webapp/WEB-INF/jsp/users.jsp	Thu Dec 29 14:50:35 2022 +0100
     8.3 @@ -42,17 +42,36 @@
     8.4  
     8.5  <c:if test="${not empty viewmodel.users}">
     8.6      <table class="datatable medskip">
     8.7 +        <colgroup>
     8.8 +            <col>
     8.9 +            <col>
    8.10 +            <col style="width: 12%">
    8.11 +            <col style="width: 12%">
    8.12 +            <col style="width: 12%">
    8.13 +        </colgroup>
    8.14          <thead>
    8.15          <tr>
    8.16 +            <th colspan="2"></th>
    8.17 +            <th colspan="3" class="hcenter">
    8.18 +                <fmt:message key="issues"/>
    8.19 +            </th>
    8.20 +        </tr>
    8.21 +        <tr>
    8.22              <th></th>
    8.23              <th><fmt:message key="user.displayname"/></th>
    8.24 +            <th class="hcenter"><fmt:message key="issues.open" /></th>
    8.25 +            <th class="hcenter"><fmt:message key="issues.active" /></th>
    8.26 +            <th class="hcenter"><fmt:message key="issues.done" /></th>
    8.27          </tr>
    8.28          </thead>
    8.29          <tbody>
    8.30 -        <c:forEach var="user" items="${viewmodel.users}">
    8.31 +        <c:forEach var="userdata" items="${viewmodel.users}">
    8.32              <tr>
    8.33 -                <td><a href="./users/${user.id}/edit">&#x270e;</a></td>
    8.34 -                <td><c:out value="${user.displayname}"/></td>
    8.35 +                <td><a href="./users/${userdata.user.id}/edit">&#x270e;</a></td>
    8.36 +                <td><c:out value="${userdata.user.displayname}"/></td>
    8.37 +                <td class="hright">${userdata.issueSummary.open}</td>
    8.38 +                <td class="hright">${userdata.issueSummary.active}</td>
    8.39 +                <td class="hright">${userdata.issueSummary.done}</td>
    8.40              </tr>
    8.41          </c:forEach>
    8.42          </tbody>

mercurial