# HG changeset patch # User Mike Becker # Date 1672766751 -3600 # Node ID d8ec2d8ffa8230c48c3cf17a8ba44180a4c1eebe # Parent 65c72e65ff67903c48f0013034886eb83f40f443 fix default sort criteria diff -r 65c72e65ff67 -r d8ec2d8ffa82 src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt --- a/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt Tue Jan 03 18:19:40 2023 +0100 +++ b/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt Tue Jan 03 18:25:51 2023 +0100 @@ -187,7 +187,7 @@ val issues = dao.listIssues(project, version, component) .sortedWith( IssueSorter( - IssueSorter.Criteria(IssueSorter.Field.STATUS), + IssueSorter.Criteria(IssueSorter.Field.DONE), IssueSorter.Criteria(IssueSorter.Field.ETA), IssueSorter.Criteria(IssueSorter.Field.UPDATED, false) ) diff -r 65c72e65ff67 -r d8ec2d8ffa82 src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt --- a/src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt Tue Jan 03 18:19:40 2023 +0100 +++ b/src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt Tue Jan 03 18:25:51 2023 +0100 @@ -37,7 +37,7 @@ class IssueSorter(private vararg val criteria: Criteria) : Comparator { enum class Field { - STATUS, CATEGORY, ETA, UPDATED, CREATED + DONE, PHASE, STATUS, CATEGORY, ETA, UPDATED, CREATED } data class Criteria(val field: Field, val asc: Boolean = true) @@ -48,6 +48,8 @@ } for (c in criteria) { val result = when (c.field) { + Field.PHASE -> left.status.phase.compareTo(right.status.phase) + Field.DONE -> (left.status.phase == IssueStatusPhase.Done).compareTo(right.status.phase == IssueStatusPhase.Done) Field.STATUS -> left.status.compareTo(right.status) Field.CATEGORY -> left.category.compareTo(right.category) Field.ETA -> left.compareEtaTo(right.eta)