sort issue suggestions by id - resolves #725

Sun, 14 Sep 2025 13:17:54 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 14 Sep 2025 13:17:54 +0200
changeset 381
334e8fb88614
parent 380
a14b143330c4
child 382
f50f2f75fee5

sort issue suggestions by id - resolves #725

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/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
--- a/src/main/kotlin/de/uapcore/lightpit/dao/DataAccessObject.kt	Sat Sep 06 14:22:38 2025 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/dao/DataAccessObject.kt	Sun Sep 14 13:17:54 2025 +0200
@@ -98,7 +98,8 @@
     /**
      * Search for issue by subject and id using the case-insensitive [query].
      * Optionally search only in the specified [project].
-     * The strings returned will have the format "#{id} - {subject}".
+     * The strings returned will have the format "#{id} - {subject}"
+     * and are sorted by id in descending order.
      * Intended for search fields and auto-completion.
      */
     fun searchIssues(query: String, project: Project? = null): List<String>
--- a/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Sat Sep 06 14:22:38 2025 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt	Sun Sep 14 13:17:54 2025 +0200
@@ -772,7 +772,7 @@
 
     override fun searchIssues(query: String, project: Project?): List<String> {
         // language=SQL
-        var subquery = "select concat('#', issueid, ' - ', subject) as title from lpit_issue"
+        var subquery = "select issueid, concat('#', issueid, ' - ', subject) as title from lpit_issue"
         if (project != null) {
             // language=SQL
             subquery = "$subquery where project = ?"
@@ -781,6 +781,7 @@
             with issue_titles as ($subquery)
             select title from issue_titles
             where title ilike concat('%', ?, '%')
+            order by issueid desc
         """.trimIndent()) {
             if (project == null) {
                 setString(1, query)
--- a/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Sat Sep 06 14:22:38 2025 +0200
+++ b/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Sun Sep 14 13:17:54 2025 +0200
@@ -33,6 +33,7 @@
     <li>Es können nun neue Vorgänge direkt mit einer Verknüpfung zu einem existierenden Vorgang erstellt werden.</li>
     <li>Neuen Filter "zeige nur nicht-blockierte" hinzugefügt.</li>
     <li>Vorgänge können nun auch direkt über die Vorgangsnummer (anstatt Raute + Nummer) verlinkt werden.</li>
+    <li>Die Vorschläge in den Suchfeldern für Vorgänge sind nun absteigend nach Vorgangsnummer sortiert.</li>
     <li>Die Standardkategorie für neue Vorgänge in veröffentlichten Versionen ist nun "Fehler" anstelle von "Feature".</li>
     <li>Vorgänge können nicht länger mit sich selbst verlinkt werden.</li>
     <li>Fehler in der Deutschen Übersetzung behoben.</li>
--- a/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Sat Sep 06 14:22:38 2025 +0200
+++ b/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Sun Sep 14 13:17:54 2025 +0200
@@ -33,6 +33,7 @@
     <li>Add the possibility to create new related issues with one click.</li>
     <li>Add new filter "show only non-blocked".</li>
     <li>Change that you can now relate issues by just submitting their number (instead of hash + number).</li>
+    <li>Change that issues suggested by the search boxes are now sorted by ID in descending order.</li>
     <li>Change that the default category for new issues in released versions is Bug instead of Feature.</li>
     <li>Fix that issues could relate to themselves.</li>
     <li>Fix errors in the German translation.</li>

mercurial