# HG changeset patch # User Mike Becker # Date 1629377464 -7200 # Node ID dcb1d5a7ea3a4c9d198c82d0306ae8f9f6f5d58b # Parent 95b419e054fa4a88030a249851bba29490154665 #163 removes multi selection for versions diff -r 95b419e054fa -r dcb1d5a7ea3a setup/postgres/psql_create_tables.sql --- a/setup/postgres/psql_create_tables.sql Wed Aug 18 16:02:40 2021 +0200 +++ b/setup/postgres/psql_create_tables.sql Thu Aug 19 14:51:04 2021 +0200 @@ -96,21 +96,9 @@ assignee integer references lpit_user (userid), created timestamp with time zone not null default now(), updated timestamp with time zone not null default now(), - eta date -); - -create table lpit_issue_affected_version -( - issueid integer references lpit_issue (issueid), - versionid integer references lpit_version (versionid), - primary key (issueid, versionid) -); - -create table lpit_issue_resolved_version -( - issueid integer references lpit_issue (issueid), - versionid integer references lpit_version (versionid), - primary key (issueid, versionid) + eta date, + affected integer references lpit_version (versionid), + resolved integer references lpit_version (versionid) ); create table lpit_issue_comment diff -r 95b419e054fa -r dcb1d5a7ea3a src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt --- a/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt Wed Aug 18 16:02:40 2021 +0200 +++ b/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt Thu Aug 19 14:51:04 2021 +0200 @@ -153,18 +153,13 @@ override fun listVersionSummaries(project: Project): List = withStatement( - """ - with version_map(issueid, versionid, isresolved) as ( - select issueid, versionid, true - from lpit_issue_resolved_version - union - select issueid, versionid, false - from lpit_issue_affected_version - ), - issues as ( - select versionid, phase, isresolved, count(issueid) as total - from lpit_issue - join version_map using (issueid) + """with + version_map as ( + select issueid, status, resolved as versionid, true as isresolved from lpit_issue + union all + select issueid, status, affected as versionid, false as isresolved from lpit_issue + ), issues as ( + select versionid, phase, isresolved, count(issueid) as total from version_map join lpit_issue_phases using (status) group by versionid, phase, isresolved ), @@ -461,7 +456,7 @@ component, c.name as componentname, c.node as componentnode, status, category, subject, i.description, userid, username, givenname, lastname, mail, - created, updated, eta + created, updated, eta, affected, resolved from lpit_issue i join lpit_project p on i.project = projectid left join lpit_component c on component = c.id @@ -490,30 +485,10 @@ created = getTimestamp("created") updated = getTimestamp("updated") eta = getDate("eta") + affected = getInt("affected").takeIf { it > 0 }?.let { findVersion(it) } + resolved = getInt("resolved").takeIf { it > 0 }?.let { findVersion(it) } } - //language=SQL - val queryAffected = - """ - $versionQuery join lpit_issue_affected_version using (versionid) - where issueid = ? order by ordinal, name - """.trimIndent() - - //language=SQL - val queryResolved = - """ - $versionQuery join lpit_issue_resolved_version using (versionid) - where issueid = ? order by ordinal, name - """.trimIndent() - - issue.affectedVersions = withStatement(queryAffected) { - setInt(1, issue.id) - queryAll { it.extractVersion() } - } - issue.resolvedVersions = withStatement(queryResolved) { - setInt(1, issue.id) - queryAll { it.extractVersion() } - } return issue } @@ -527,26 +502,18 @@ setStringOrNull(i++, description) setIntOrNull(i++, assignee?.id) setDateOrNull(i++, eta) + setIntOrNull(i++, affected?.id) + setIntOrNull(i++, resolved?.id) } return i } override fun listIssues(filter: IssueFilter): List = withStatement( - """ - with issue_version as ( - select issueid, versionid from lpit_issue_affected_version - union select issueid, versionid from lpit_issue_resolved_version - ), - filtered_issues as ( - select distinct issueid from lpit_issue - left join issue_version using (issueid) - where - (not ? or project = ?) and - (not ? or versionid = ?) and (not ? or versionid is null) and + """$issueQuery where + (not ? or i.project = ?) and + (not ? or ? in (resolved, affected)) and (not ? or (resolved is null and affected is null)) and (not ? or component = ?) and (not ? or component is null) - ) - $issueQuery join filtered_issues using (issueid) """.trimIndent() ) { fun applyFilter(filter: Filter, fflag: Int, nflag: Int, idcol: Int) { @@ -594,27 +561,10 @@ querySingle { it.extractIssue() } } - private fun insertVersionInfo(id: Int, issue: Issue) { - withStatement("insert into lpit_issue_affected_version (issueid, versionid) values (?,?)") { - setInt(1, id) - issue.affectedVersions.forEach { - setInt(2, it.id) - executeUpdate() - } - } - withStatement("insert into lpit_issue_resolved_version (issueid, versionid) values (?,?)") { - setInt(1, id) - issue.resolvedVersions.forEach { - setInt(2, it.id) - executeUpdate() - } - } - } - override fun insertIssue(issue: Issue): Int { val id = withStatement( """ - insert into lpit_issue (component, status, category, subject, description, assignee, eta, project) + insert into lpit_issue (component, status, category, subject, description, assignee, eta, affected, resolved, project) values (?, ?::issue_status, ?::issue_category, ?, ?, ?, ?, ?) returning issueid """.trimIndent() @@ -623,7 +573,6 @@ setInt(col, issue.project.id) querySingle { it.getInt(1) }!! } - insertVersionInfo(id, issue) return id } @@ -632,7 +581,7 @@ """ update lpit_issue set updated = now(), component = ?, status = ?::issue_status, category = ?::issue_category, subject = ?, - description = ?, assignee = ?, eta = ? + description = ?, assignee = ?, eta = ?, affected = ?, resolved = ? where issueid = ? """.trimIndent() ) { @@ -640,17 +589,6 @@ setInt(col, issue.id) executeUpdate() } - - // TODO: improve by only inserting / deleting changed version information - withStatement("delete from lpit_issue_affected_version where issueid = ?") { - setInt(1, issue.id) - executeUpdate() - } - withStatement("delete from lpit_issue_resolved_version where issueid = ?") { - setInt(1, issue.id) - executeUpdate() - } - insertVersionInfo(issue.id, issue) } // diff -r 95b419e054fa -r dcb1d5a7ea3a src/main/kotlin/de/uapcore/lightpit/entities/Issue.kt --- a/src/main/kotlin/de/uapcore/lightpit/entities/Issue.kt Wed Aug 18 16:02:40 2021 +0200 +++ b/src/main/kotlin/de/uapcore/lightpit/entities/Issue.kt Thu Aug 19 14:51:04 2021 +0200 @@ -45,8 +45,8 @@ var updated: Timestamp = Timestamp.from(Instant.now()) var eta: Date? = null - var affectedVersions = emptyList() - var resolvedVersions = emptyList() + var affected: Version? = null + var resolved: Version? = null /** * An issue is overdue, if it is not done and the ETA is before the current time. diff -r 95b419e054fa -r dcb1d5a7ea3a src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt --- a/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt Wed Aug 18 16:02:40 2021 +0200 +++ b/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt Thu Aug 19 14:51:04 2021 +0200 @@ -482,9 +482,9 @@ // pre-select version, if available in the path info if (version != null) { if (version.status.isReleased) { - issue.affectedVersions = listOf(version) + issue.affected = version } else { - issue.resolvedVersions = listOf(version) + issue.resolved = version } } } @@ -565,10 +565,8 @@ // TODO: process error messages eta = http.param("eta", ::dateOptValidator, null, mutableListOf()) - affectedVersions = http.paramArray("affected") - .mapNotNull { param -> param.toIntOrNull()?.let { Version(it, project.id) } } - resolvedVersions = http.paramArray("resolved") - .mapNotNull { param -> param.toIntOrNull()?.let { Version(it, project.id) } } + affected = http.param("affected")?.toIntOrNull()?.takeIf { it > 0 }?.let { Version(it, project.id) } + resolved = http.param("resolved")?.toIntOrNull()?.takeIf { it > 0 }?.let { Version(it, project.id) } } val openId = if (issue.id < 0) { diff -r 95b419e054fa -r dcb1d5a7ea3a src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt --- a/src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt Wed Aug 18 16:02:40 2021 +0200 +++ b/src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt Thu Aug 19 14:51:04 2021 +0200 @@ -76,7 +76,7 @@ val renderer = HtmlRenderer.builder(options).build() val process = fun(it: String) = renderer.render(parser.parse(it)) - issue.description = process(issue.description?:"") + issue.description = process(issue.description ?: "") for (comment in comments) { comment.commentFormatted = process(comment.comment) } @@ -101,9 +101,10 @@ init { val recent = mutableListOf() + issue.affected?.let { recent.add(it) } val upcoming = mutableListOf() - recent.addAll(issue.affectedVersions) - upcoming.addAll(issue.resolvedVersions) + issue.resolved?.let { upcoming.add(it) } + for (v in versions) { if (v.status.isReleased) { if (v.status != VersionStatus.Deprecated) recent.add(v) diff -r 95b419e054fa -r dcb1d5a7ea3a src/main/kotlin/de/uapcore/lightpit/viewmodel/Versions.kt --- a/src/main/kotlin/de/uapcore/lightpit/viewmodel/Versions.kt Wed Aug 18 16:02:40 2021 +0200 +++ b/src/main/kotlin/de/uapcore/lightpit/viewmodel/Versions.kt Thu Aug 19 14:51:04 2021 +0200 @@ -42,11 +42,11 @@ val reported = mutableListOf() val resolved = mutableListOf() for (issue in issues) { - if (issue.affectedVersions.contains(version)) { + if (issue.affected == version) { reportedTotal.add(issue) reported.add(issue) } - if (issue.resolvedVersions.contains(version)) { + if (issue.resolved == version) { resolvedTotal.add(issue) resolved.add(issue) } diff -r 95b419e054fa -r dcb1d5a7ea3a src/main/resources/localization/strings.properties --- a/src/main/resources/localization/strings.properties Wed Aug 18 16:02:40 2021 +0200 +++ b/src/main/resources/localization/strings.properties Thu Aug 19 14:51:04 2021 +0200 @@ -121,6 +121,7 @@ placeholder.null-component=Unassigned placeholder.null-lead=Unassigned placeholder.null-owner=Unassigned +placeholder.null-version=None progress=Overall Progress project.name=Name project.owner=Project Lead diff -r 95b419e054fa -r dcb1d5a7ea3a src/main/resources/localization/strings_de.properties --- a/src/main/resources/localization/strings_de.properties Wed Aug 18 16:02:40 2021 +0200 +++ b/src/main/resources/localization/strings_de.properties Thu Aug 19 14:51:04 2021 +0200 @@ -120,6 +120,7 @@ placeholder.null-component=Keine placeholder.null-lead=Niemand placeholder.null-owner=Nicht Zugewiesen +placeholder.null-version=Keine progress=Gesamtfortschritt project.name=Name project.owner=Projektleitung diff -r 95b419e054fa -r dcb1d5a7ea3a src/main/webapp/WEB-INF/changelogs/changelog-de.jspf --- a/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf Wed Aug 18 16:02:40 2021 +0200 +++ b/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf Thu Aug 19 14:51:04 2021 +0200 @@ -27,6 +27,7 @@

Version 1.0 (Vorschau)

    +
  • Mehrfachauswahl für Versionen im Vorgang entfernt.
  • Möglichkeit zum Deaktivieren einer Komponente hinzugefügt.
  • Datum der Veröffentlichung und des Supportendes zu Versionen hinzugefügt.
  • Gesamtanzahl der Kommentare wird nun angezeigt.
  • diff -r 95b419e054fa -r dcb1d5a7ea3a src/main/webapp/WEB-INF/changelogs/changelog.jspf --- a/src/main/webapp/WEB-INF/changelogs/changelog.jspf Wed Aug 18 16:02:40 2021 +0200 +++ b/src/main/webapp/WEB-INF/changelogs/changelog.jspf Thu Aug 19 14:51:04 2021 +0200 @@ -27,6 +27,7 @@

    Version 1.0 (snapshot)

      +
    • Removes multi selection of versions within an issue.
    • Adds possibility to deactivate a component.
    • Adds release and end of life dates to versions.
    • Adds the total number of comments to the caption.
    • diff -r 95b419e054fa -r dcb1d5a7ea3a src/main/webapp/WEB-INF/jsp/issue-form.jsp --- a/src/main/webapp/WEB-INF/jsp/issue-form.jsp Wed Aug 18 16:02:40 2021 +0200 +++ b/src/main/webapp/WEB-INF/jsp/issue-form.jsp Thu Aug 19 14:51:04 2021 +0200 @@ -125,19 +125,27 @@ - - - - <%@include file="../jspf/version-list.jspf"%> + - - - - <%@include file="../jspf/version-list.jspf"%> + diff -r 95b419e054fa -r dcb1d5a7ea3a src/main/webapp/WEB-INF/jsp/issue-view.jsp --- a/src/main/webapp/WEB-INF/jsp/issue-view.jsp Wed Aug 18 16:02:40 2021 +0200 +++ b/src/main/webapp/WEB-INF/jsp/issue-view.jsp Thu Aug 19 14:51:04 2021 +0200 @@ -95,15 +95,11 @@ - - - + - - - + diff -r 95b419e054fa -r dcb1d5a7ea3a src/main/webapp/WEB-INF/jspf/version-list.jspf --- a/src/main/webapp/WEB-INF/jspf/version-list.jspf Wed Aug 18 16:02:40 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> - -