Sat, 04 Jun 2022 18:35:45 +0200
replace sorting by DONE with sorting by PHASE
--- a/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt Sat Jun 04 18:29:58 2022 +0200 +++ b/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt Sat Jun 04 18:35:45 2022 +0200 @@ -188,7 +188,7 @@ val issues = dao.listIssues(project, version, component) .sortedWith( IssueSorter( - IssueSorter.Criteria(IssueSorter.Field.DONE), + IssueSorter.Criteria(IssueSorter.Field.PHASE), IssueSorter.Criteria(IssueSorter.Field.ETA), IssueSorter.Criteria(IssueSorter.Field.UPDATED, false) )
--- a/src/main/kotlin/de/uapcore/lightpit/types/IssueStatusPhase.kt Sat Jun 04 18:29:58 2022 +0200 +++ b/src/main/kotlin/de/uapcore/lightpit/types/IssueStatusPhase.kt Sat Jun 04 18:35:45 2022 +0200 @@ -25,10 +25,13 @@ package de.uapcore.lightpit.types -data class IssueStatusPhase(val number: Int) { +data class IssueStatusPhase(val number: Int): Comparable<IssueStatusPhase> { companion object { val Open = IssueStatusPhase(0) val WorkInProgress = IssueStatusPhase(1) val Done = IssueStatusPhase(2) } + + override fun compareTo(other: IssueStatusPhase): Int = + number.compareTo(other.number) } \ No newline at end of file
--- a/src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt Sat Jun 04 18:29:58 2022 +0200 +++ b/src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt Sat Jun 04 18:35:45 2022 +0200 @@ -40,7 +40,7 @@ class IssueSorter(private vararg val criteria: Criteria) : Comparator<Issue> { enum class Field { - DONE, ETA, UPDATED + PHASE, ETA, UPDATED } data class Criteria(val field: Field, val asc: Boolean = true) @@ -51,7 +51,7 @@ } for (c in criteria) { val result = when (c.field) { - Field.DONE -> (left.status.phase == IssueStatusPhase.Done).compareTo(right.status.phase == IssueStatusPhase.Done) + Field.PHASE -> left.status.phase.compareTo(right.status.phase) Field.ETA -> { val l = left.eta val r = right.eta