Tue, 03 Jan 2023 18:25:51 +0100
fix default sort criteria
--- 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) )
--- 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<Issue> { 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)